Configure imaging
These are the default settings for processing images:
imaging:
anchor: smart
avif:
compression: lossy
encoderSpeed: 10
hint: photo
quality: 60
bgColor: ffffff
exif:
disableDate: false
disableLatLong: false
excludeFields: GPS|Exif|Exposure[M|P|B]|Contrast|Resolution|Sharp|JPEG|Metering|Sensing|Saturation|ColorSpace|Flash|WhiteBalance
includeFields: ''
jpeg:
quality: 75
meta:
fields:
- '! *{GPS,Exif,Exposure[MPB],Contrast,Resolution,Sharp,JPEG,Metering,Sensing,Saturation,ColorSpace,Flash,WhiteBalance}*'
sources:
- exif
- iptc
resampleFilter: box
webp:
compression: lossy
hint: photo
method: 2
quality: 75
useSharpYuv: false
[imaging]
anchor = 'smart'
bgColor = 'ffffff'
resampleFilter = 'box'
[imaging.avif]
compression = 'lossy'
encoderSpeed = 10
hint = 'photo'
quality = 60
[imaging.exif]
disableDate = false
disableLatLong = false
excludeFields = 'GPS|Exif|Exposure[M|P|B]|Contrast|Resolution|Sharp|JPEG|Metering|Sensing|Saturation|ColorSpace|Flash|WhiteBalance'
includeFields = ''
[imaging.jpeg]
quality = 75
[imaging.meta]
fields = ['! *{GPS,Exif,Exposure[MPB],Contrast,Resolution,Sharp,JPEG,Metering,Sensing,Saturation,ColorSpace,Flash,WhiteBalance}*']
sources = ['exif', 'iptc']
[imaging.webp]
compression = 'lossy'
hint = 'photo'
method = 2
quality = 75
useSharpYuv = false
{
"imaging": {
"anchor": "smart",
"avif": {
"compression": "lossy",
"encoderSpeed": 10,
"hint": "photo",
"quality": 60
},
"bgColor": "ffffff",
"exif": {
"disableDate": false,
"disableLatLong": false,
"excludeFields": "GPS|Exif|Exposure[M|P|B]|Contrast|Resolution|Sharp|JPEG|Metering|Sensing|Saturation|ColorSpace|Flash|WhiteBalance",
"includeFields": ""
},
"jpeg": {
"quality": 75
},
"meta": {
"fields": [
"! *{GPS,Exif,Exposure[MPB],Contrast,Resolution,Sharp,JPEG,Metering,Sensing,Saturation,ColorSpace,Flash,WhiteBalance}*"
],
"sources": [
"exif",
"iptc"
]
},
"resampleFilter": "box",
"webp": {
"compression": "lossy",
"hint": "photo",
"method": 2,
"quality": 75,
"useSharpYuv": false
}
}
}
Top-level settings
These settings apply to all image formats.
anchor- (
string) The focal point used when cropping or filling an image. Valid case-insensitive options includeTopLeft,Top,TopRight,Left,Center,Right,BottomLeft,Bottom,BottomRight, orSmart. TheSmartoption utilizes themuesli/smartcroppackage to identify the most interesting area of the image. Default issmart. bgColor- (
string) The background color used when converting transparent images to formats that do not support transparency, such as PNG to JPEG. This color also fills the empty space created when rotating an image by a non-orthogonal angle if the space is not transparent and a background color is not specified in the processing specification. The value must be an RGB hexadecimal color. Default is#ffffff. compression- Deprecated in v0.163.0
- Use the format-specific
compressionsetting instead, applicable to AVIF and WebP images. hint- Deprecated in v0.163.0
- Use the format-specific
hintsetting instead, applicable to AVIF and WebP images. quality- Deprecated in v0.163.0
- Use the format-specific
qualitysetting instead, applicable to AVIF, JPEG, and WebP images. resampleFilter- (
string) The algorithm used to calculate new pixels when resizing, fitting, or filling an image. Common case-insensitive options includebox,lanczos,catmullRom,mitchellNetravali,linear, ornearestNeighbor. Default isbox.Filter Description boxSimple and fast averaging filter appropriate for downscaling lanczosHigh-quality resampling filter for photographic images yielding sharp results catmullRomSharp cubic filter that is faster than the Lanczos filter while providing similar results mitchellNetravaliCubic filter that produces smoother results with less ringing artifacts than CatmullRom linearBilinear resampling filter, produces smooth output, faster than cubic filters nearestNeighborFastest resampling filter, no antialiasing Refer to the source documentation for a complete list of available resampling filters. If you wish to improve image quality at the expense of performance, you may wish to experiment with the alternative filters.
AVIF
New in v0.162.0These settings apply when encoding AVIF images.
When exporting HDR AVIF images from Lightroom, in the Export dialog under File Settings, uncheck Maximize Compatibility to improve Hugo’s AVIF decoding speed.
Encoding animated images to AVIF produces a single-frame (static) image. Converting an animated AVIF to another format such as GIF works as expected.
imaging:
avif:
compression: lossy
encoderSpeed: 10
hint: photo
quality: 60
[imaging]
[imaging.avif]
compression = 'lossy'
encoderSpeed = 10
hint = 'photo'
quality = 60
{
"imaging": {
"avif": {
"compression": "lossy",
"encoderSpeed": 10,
"hint": "photo",
"quality": 60
}
}
}
compression- New in v0.163.0
- (
string) The encoding strategy. Options arelossyorlossless. Default islossy. encoderSpeed- (
int) The encoder speed. Expressed as a whole number from1to10, inclusive, equivalent to the-sflag for theavifencCLI. Lower numbers reduce file size at the cost of build time. At typical web image sizes, quality is indistinguishable across settings. Values below5may cause significantly longer build times. Default is10. hint- New in v0.163.0
- (
string) The content hint. Valid options includedrawing,icon,photo,picture, ortext. Hugo uses the4:2:0chroma subsampling format withphotoandpicture, and4:4:4with the remaining options. Default isphoto.Value Example drawingHand or line drawing with high-contrast details iconSmall colorful image photoOutdoor photograph with natural lighting pictureIndoor photograph such as a portrait textImage that is primarily text quality- New in v0.163.0
- (
int) The visual fidelity when usinglossycompression. Expressed as a whole number from1to100, inclusive. Lower numbers prioritize smaller file size, while higher numbers prioritize visual clarity. Default is60. Quality values are encoder-specific and not directly comparable across formats; a value of60for AVIF is perceptually similar to75for JPEG.
JPEG
New in v0.163.0These settings apply when encoding JPEG images.
imaging:
jpeg:
quality: 75
[imaging]
[imaging.jpeg]
quality = 75
{
"imaging": {
"jpeg": {
"quality": 75
}
}
}
quality- (
int) The visual fidelity. Expressed as a whole number from1to100, inclusive. Lower numbers prioritize smaller file size, while higher numbers prioritize visual clarity. Default is75.
WebP
New in v0.155.0These settings apply when encoding WebP images.
imaging:
webp:
compression: lossy
hint: photo
method: 2
quality: 75
useSharpYuv: false
[imaging]
[imaging.webp]
compression = 'lossy'
hint = 'photo'
method = 2
quality = 75
useSharpYuv = false
{
"imaging": {
"webp": {
"compression": "lossy",
"hint": "photo",
"method": 2,
"quality": 75,
"useSharpYuv": false
}
}
}
compression- New in v0.163.0
- (
string) The encoding strategy. Options arelossyorlossless. Default islossy. hint- (
string) The content hint, equivalent to the-presetflag for thecwebpCLI. Valid options includedrawing,icon,photo,picture, ortext. Default isphoto.Value Example drawingHand or line drawing with high-contrast details iconSmall colorful image photoOutdoor photograph with natural lighting pictureIndoor photograph such as a portrait textImage that is primarily text method- (
int) The effort level of the compression algorithm. Expressed as a whole number from0to6, inclusive, equivalent to the-mflag for thecwebpCLI. Lower numbers prioritize processing speed, while higher numbers prioritize compression efficiency and image quality. Default is2. quality- New in v0.163.0
- (
int) The visual fidelity when usinglossycompression. Expressed as a whole number from1to100, inclusive. Lower numbers prioritize smaller file size, while higher numbers prioritize visual clarity. Default is75. useSharpYuv- (
bool) The conversion method used for RGB-to-YUV encoding, equivalent to the-sharp_yuvflag for thecwebpCLI. Enabling this prioritizes image sharpness at the expense of processing speed. Default isfalse.
Exif method
Meta method
New in v0.155.0The following parameters allow you to control how Hugo extracts and filters metadata when using the [Meta][] method, helping you balance data granularity with build performance.
fields- (
[]string) A glob slice matching the fields to include when extracting metadata. If empty, a default set excluding technical metadata is used. Set to['**']to include all fields.By default, to improve performance and decrease cache size, Hugo excludes the following fields:
ColorSpace,Contrast,Exif,ExposureBias,ExposureMode,ExposureProgram,Flash,GPS,JPEG,Metering,Resolution,Saturation,Sensing,Sharp, andWhiteBalance. sources- (
[]string) The metadata sources to include, one or more ofexif,iptc, orxmp. Default is['exif', 'iptc']. The XMP metadata is excluded by default to improve performance.
