Configure imaging
Processing options
These are the default settings for processing images:
imaging:
anchor: Smart
bgColor: '#ffffff'
compression: lossy
quality: 75
resampleFilter: box
[imaging]
anchor = 'Smart'
bgColor = '#ffffff'
compression = 'lossy'
quality = 75
resampleFilter = 'box'
{
"imaging": {
"anchor": "Smart",
"bgColor": "#ffffff",
"compression": "lossy",
"quality": 75,
"resampleFilter": "box"
}
}
- anchor
- (
string) The focal point used when cropping or filling an image. Valid options includeTopLeft,Top,TopRight,Left,Center,Right,BottomLeft,Bottom,BottomRight, orSmart. TheSmartoption utilizes thesmartcrop.jslibrary 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
- New in v0.153.5
- (
string) The encoding strategy used for the image. Options arelossyorlossless. Note thatlosslessis only supported by the WebP format. Default islossy. - quality
- (
int) The visual fidelity of the image, applicable to JPEG and WebP formats when usinglossycompression. Expressed as a whole number from1to100, inclusive. Lower numbers prioritize smaller file size, while higher numbers prioritize visual clarity. Default is75. - resampleFilter
- (
string) The algorithm used to calculate new pixels when resizing, fitting, or filling an image. Common 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.
WebP images
New in v0.155.0These are the default settings specific to processing WebP images:
imaging:
webp:
hint: photo
method: 4
useSharpYuv: true
[imaging]
[imaging.webp]
hint = 'photo'
method = 4
useSharpYuv = true
{
"imaging": {
"webp": {
"hint": "photo",
"method": 4,
"useSharpYuv": true
}
}
}
- hint
- (
string) The encoding preset used when processing WebP images, 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. Default is4. - 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 istrue.
Exif method
These are the default settings for the Exif method on an image Resource object:
imaging:
exif:
disableDate: false
disableLatLong: false
excludeFields: ''
includeFields: ''
[imaging]
[imaging.exif]
disableDate = false
disableLatLong = false
excludeFields = ''
includeFields = ''
{
"imaging": {
"exif": {
"disableDate": false,
"disableLatLong": false,
"excludeFields": "",
"includeFields": ""
}
}
}
- disableDate
- (
bool) Whether to disable the [Date][] method by returning its zero value. Default isfalse. - disableLatLong
- (
bool) Whether to disable the [Lat][] and [Long][] methods by returning their zero values. Default isfalse. - excludeFields
- (
string) A regular expression matching the fields to exclude when extracting metadata.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. - includeFields
- (
string) A regular expression matching the fields to include when extracting metadata. If empty, a default set excluding technical metadata is used. Set to'.*'to include all fields.
Meta method
New in v0.155.0These are the default settings for the Meta method on an image Resource object:
imaging:
meta:
fields: []
sources:
- exif
- iptc
[imaging]
[imaging.meta]
fields = []
sources = ['exif', 'iptc']
{
"imaging": {
"meta": {
"fields": [],
"sources": [
"exif",
"iptc"
]
}
}
}
- 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.
