You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/commands/hugo_gen_chromastyles.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Generate CSS stylesheet for the Chroma code highlighter
11
11
12
12
Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if markup.highlight.noClasses is disabled in config.
13
13
14
-
See https://xyproto.github.io/splash/docs/all.html for a preview of the available styles
14
+
See https://gohugo.io/quick-reference/syntax-highlighting-styles/ for a preview of the available styles.
15
15
16
16
```
17
17
hugo gen chromastyles [flags] [args]
@@ -26,7 +26,7 @@ hugo gen chromastyles [flags] [args]
26
26
--lineNumbersTableStyle string foreground and background colors for table line numbers, e.g. --lineNumbersTableStyle "#fff000 bg:#000fff"
27
27
--omitClassComments omit CSS class comment prefixes in the generated CSS
28
28
--omitEmpty omit empty CSS rules (deprecated, no longer needed)
29
-
--style string highlighter style (see https://xyproto.github.io/splash/docs/) (default "friendly")
Copy file name to clipboardExpand all lines: content/en/configuration/imaging.md
+31-57Lines changed: 31 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,21 +6,16 @@ categories: []
6
6
keywords: []
7
7
---
8
8
9
-
## Processing options
10
-
11
9
These are the default settings for processing images:
12
10
13
-
{{< code-toggle file=hugo >}}
14
-
[imaging]
15
-
anchor = 'Smart'
16
-
bgColor = '#ffffff'
17
-
compression = 'lossy'
18
-
quality = 75
19
-
resampleFilter = 'box'
20
-
{{< /code-toggle >}}
11
+
{{< code-toggle config=imaging />}}
12
+
13
+
## Top-level options
14
+
15
+
These global settings define how Hugo handles the fundamental aspects of image manipulation, such as cropping logic, background colors, and general output quality.
21
16
22
17
anchor
23
-
: (`string`) The focal point used when cropping or filling an image. Valid options include `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. The `Smart` option utilizes the [`smartcrop.js`][] library to identify the most interesting area of the image. Default is `Smart`.
18
+
: (`string`) The focal point used when cropping or filling an image. Valid case-insensitive options include `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. The `Smart` option utilizes the [`smartcrop.js`][] library to identify the most interesting area of the image. Default is `smart`.
24
19
25
20
bgColor
26
21
: (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`.
@@ -46,47 +41,9 @@ resampleFilter
46
41
47
42
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.
48
43
49
-
## WebP images
50
-
51
-
{{< new-in 0.155.0 />}}
52
-
53
-
These are the default settings specific to processing WebP images:
54
-
55
-
{{< code-toggle file=hugo >}}
56
-
[imaging.webp]
57
-
hint = 'photo'
58
-
method = 4
59
-
useSharpYuv = true
60
-
{{< /code-toggle >}}
61
-
62
-
hint
63
-
: (`string`) The encoding preset used when processing WebP images, equivalent to the `-preset` flag for the [`cwebp`][] CLI. Valid options include `drawing`, `icon`, `photo`, `picture`, or `text`. Default is `photo`.
64
-
65
-
Value|Example
66
-
:--|:--
67
-
`drawing`|Hand or line drawing with high-contrast details
68
-
`icon`|Small colorful image
69
-
`photo`|Outdoor photograph with natural lighting
70
-
`picture`|Indoor photograph such as a portrait
71
-
`text`|Image that is primarily text
72
-
73
-
method
74
-
: (`int`) The effort level of the compression algorithm. Expressed as a whole number from `0` to `6`, inclusive, equivalent to the `-m` flag for the [`cwebp`][] CLI. Lower numbers prioritize processing speed, while higher numbers prioritize compression efficiency. Default is `4`.
75
-
76
-
useSharpYuv
77
-
: (`bool`) The conversion method used for RGB-to-YUV encoding, equivalent to the `-sharp_yuv` flag for the [`cwebp`][] CLI. Enabling this prioritizes image sharpness at the expense of processing speed. Default is `true`.
78
-
79
44
## Exif method
80
45
81
-
These are the default settings for the [`Exif`] method on an image `Resource` object:
82
-
83
-
{{< code-toggle file=hugo >}}
84
-
[imaging.exif]
85
-
disableDate = false
86
-
disableLatLong = false
87
-
excludeFields = ""
88
-
includeFields = ""
89
-
{{< /code-toggle >}}
46
+
The following parameters allow you to control how Hugo extracts and filters metadata when using the [`Exif`] method, helping you balance data granularity with build performance.
90
47
91
48
disableDate
92
49
: (`bool`) Whether to disable the [`Date`][] method by returning its zero value. Default is `false`.
@@ -107,13 +64,7 @@ includeFields
107
64
108
65
{{< new-in 0.155.0 />}}
109
66
110
-
These are the default settings for the [`Meta`] method on an image `Resource` object:
111
-
112
-
{{< code-toggle file=hugo >}}
113
-
[imaging.meta]
114
-
fields = []
115
-
sources = ['exif', 'iptc']
116
-
{{< /code-toggle >}}
67
+
The 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.
117
68
118
69
fields
119
70
: (`[]string`) A [glob slice](g) matching the fields to include when extracting metadata. If empty, a default set excluding technical metadata is used. Set to `['**']` to include all fields.
@@ -124,6 +75,29 @@ fields
124
75
sources
125
76
: (`[]string`) The metadata sources to include, one or more of `exif`, `iptc`, or `xmp`. Default is `['exif', 'iptc']`. The XMP metadata is excluded by default to improve performance.
126
77
78
+
## WebP images
79
+
80
+
{{< new-in 0.155.0 />}}
81
+
82
+
These specialized settings provide granular control over the WebP encoding process, allowing you to optimize compression based on the specific visual characteristics of your imagery.
83
+
84
+
hint
85
+
: (`string`) The encoding preset used when processing WebP images, equivalent to the `-preset` flag for the [`cwebp`][] CLI. Valid options include `drawing`, `icon`, `photo`, `picture`, or `text`. Default is `photo`.
86
+
87
+
Value|Example
88
+
:--|:--
89
+
`drawing`|Hand or line drawing with high-contrast details
90
+
`icon`|Small colorful image
91
+
`photo`|Outdoor photograph with natural lighting
92
+
`picture`|Indoor photograph such as a portrait
93
+
`text`|Image that is primarily text
94
+
95
+
method
96
+
: (`int`) The effort level of the compression algorithm. Expressed as a whole number from `0` to `6`, inclusive, equivalent to the `-m` flag for the [`cwebp`][] CLI. Lower numbers prioritize processing speed, while higher numbers prioritize compression efficiency. Default is `2`.
97
+
98
+
useSharpYuv
99
+
: (`bool`) The conversion method used for RGB-to-YUV encoding, equivalent to the `-sharp_yuv` flag for the [`cwebp`][] CLI. Enabling this prioritizes image sharpness at the expense of processing speed. Default is `false`.
Copy file name to clipboardExpand all lines: content/en/functions/images/Config.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ See [image processing] for an overview of Hugo's image pipeline.
20
20
{{ $ic.Height }} → 400 (int)
21
21
```
22
22
23
-
Supported image formats include GIF, JPEG, PNG, TIFF, and WebP.
23
+
Supported image formats include AVIF, BMP, GIF, HEIC, HEIF, JPEG, PNG, TIFF, and WebP.
24
24
25
25
> [!note]
26
26
> This is a legacy function, superseded by the [`Width`] and [`Height`] methods for [global resources](g), [page resources](g), and [remote resources](g). See the [image processing] section for details.
Use the `reflect.IsImageResourceProcessable` function to determine if a resource can be manipulated by Hugo's imaging pipeline such as resizing, cropping, or filtering.
20
+
21
+
```go-html-template
22
+
{{ with resources.Get "image.jpg" }}
23
+
{{ reflect.IsImageResourceProcessable . }} → true
24
+
{{ end }}
25
+
```
26
+
27
+
## Processable formats
28
+
29
+
The following table shows the result of `reflect.IsImageResourceProcessable` for various file types and their corresponding media types.
30
+
31
+
| Filename | Media Type | Processable |
32
+
| :--- | :--- | :--- |
33
+
| data.json | application/json | false |
34
+
| image.avif | image/avif | false |
35
+
| image.bmp | image/bmp | true |
36
+
| image.gif | image/gif | true |
37
+
| image.heic | image/heic | false |
38
+
| image.heif | image/heif | false |
39
+
| image.jpg | image/jpeg | true |
40
+
| image.png | image/png | true |
41
+
| image.svg | image/svg+xml | false |
42
+
| image.tiff | image/tiff | true |
43
+
| image.webp | image/webp | true |
44
+
45
+
Although AVIF, HEIC, and HEIF images are not processable, you can can determine their dimensions using the [`Width`] and [`Height`] methods.
You can use this function to safely filter a collection of images before applying transformations, ensuring that the imaging pipeline only attempts to process supported formats.
An image with metadata is an image format from which Hugo can extract dimensions and, if present, Exif, IPTC, and XMP data.
16
+
17
+
## Usage
18
+
19
+
Use the `reflect.IsImageResourceWithMeta` function to determine if a resource is an image format from which metadata can be extracted.
20
+
21
+
```go-html-template
22
+
{{ with resources.Get "image.avif" }}
23
+
{{ reflect.IsImageResourceWithMeta . }} → true
24
+
{{ end }}
25
+
```
26
+
27
+
## Formats with metadata
28
+
29
+
The following table shows the result of `reflect.IsImageResourceWithMeta` for various file types and their corresponding media types.
30
+
31
+
| Filename | Media Type | With Meta |
32
+
| :--- | :--- | :--- |
33
+
| data.json | application/json | false |
34
+
| image.avif | image/avif | true |
35
+
| image.bmp | image/bmp | false |
36
+
| image.gif | image/gif | false |
37
+
| image.heic | image/heic | true |
38
+
| image.heif | image/heif | true |
39
+
| image.jpg | image/jpeg | true |
40
+
| image.png | image/png | true |
41
+
| image.svg | image/svg+xml | false |
42
+
| image.tiff | image/tiff | true |
43
+
| image.webp | image/webp | true |
44
+
45
+
## Example
46
+
47
+
You can use this function to safely extract and display metadata from a collection of images, ensuring you only call metadata methods on supported formats.
Copy file name to clipboardExpand all lines: content/en/methods/resource/Meta.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Meta
3
-
description: Applicable to JPEG, PNG, TIFF, and WebP images, returns an object containing Exif, IPTC, and XMP metadata.
3
+
description: Returns an object containing Exif, IPTC, and XMP metadata for supported image formats.
4
4
categories: []
5
5
keywords: ['metadata']
6
6
params:
@@ -13,9 +13,8 @@ params:
13
13
14
14
{{% include "/_common/methods/resource/global-page-remote-resources.md" %}}
15
15
16
-
Applicable to JPEG, PNG, TIFF, and WebP images, the `Meta` method on an image `Resource` object returns an object containing [Exif][Exif_Definition], [IPTC][IPTC_Definition], and [XMP][XMP_Definition] metadata.
16
+
The `Meta` method on an image `Resource` object returns an object containing [Exif][Exif_Definition], [IPTC][IPTC_Definition], and [XMP][XMP_Definition] metadata. Supported formats include AVIF, HEIC, HEIF, JPEG, PNG, TIFF, and WebP.
17
17
18
-
To extract Exif metadata only, use the [`Exif`] method instead.
19
18
20
19
> [!note]
21
20
> Metadata is not preserved during image transformation. Use this method with the _original_ image resource to extract metadata from JPEG, PNG, TIFF, and WebP images.
0 commit comments