Skip to content

Commit cb18a7c

Browse files
committed
Add JPEG XL docs
1 parent 78ba19d commit cb18a7c

5 files changed

Lines changed: 29 additions & 10 deletions

File tree

docs/configuration/options.mdx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ When cookie forwarding is activated, by default, imgproxy assumes the scope of t
166166
## Compression
167167

168168
* [`IMGPROXY_QUALITY`]: the default quality of the resultant image, percentage. Default: `80`
169-
* [`IMGPROXY_FORMAT_QUALITY`]: default quality of the resulting image per format, separated by commas. Example: `jpeg=70,avif=40,webp=60`. When a value for the resulting format is not set, the `IMGPROXY_QUALITY` value is used. Default: `avif=65`
169+
* [`IMGPROXY_FORMAT_QUALITY`]: default quality of the resulting image per format, separated by commas. Example: `jpeg=70,avif=40,webp=60`. When a value for the resulting format is not set, the `IMGPROXY_QUALITY` value is used. Default: `avif=65,jxl=77`
170170

171171
### Advanced JPEG compression
172172

@@ -201,6 +201,10 @@ When cookie forwarding is activated, by default, imgproxy assumes the scope of t
201201

202202
* [`IMGPROXY_AVIF_SPEED`]: controls the CPU effort spent improving compression. The lowest speed is at 0 and the fastest is at 9. Default: `9`
203203

204+
### Advanced JPEG XL compression
205+
206+
* [`IMGPROXY_JXL_EFFORT`]: controls the CPU effort spent improving compression. The larger the value, the slower the encoding process but the better the compression. The value should be between 1 and 9. Default: `4`
207+
204208
### Autoquality
205209

206210
imgproxy can calculate the quality of the resulting image based on selected metric. Read more in the [Autoquality](../features/autoquality.mdx) guide.
@@ -220,30 +224,37 @@ Autoquality requires the image to be saved several times. Use it only when you p
220224
* [`IMGPROXY_AUTOQUALITY_JPEG_NET`]: ((pro)) the path to the neural network for JPEG.
221225
* [`IMGPROXY_AUTOQUALITY_WEBP_NET`]: ((pro)) the path to the neural network for WebP.
222226
* [`IMGPROXY_AUTOQUALITY_AVIF_NET`]: ((pro)) the path to the neural network for AVIF.
227+
* [`IMGPROXY_AUTOQUALITY_JXL_NET`]: ((pro)) the path to the neural network for JPEG XL.
223228

224229
## SVG processing
225230
* [`IMGPROXY_SVG_FIX_UNSUPPORTED`]: when `true`, imgproxy will try to replace SVG features unsupported by librsvg to minimize SVG rendering error. This config only takes effect on SVG rasterization. Default: `false`
226231
* [`IMGPROXY_ALWAYS_RASTERIZE_SVG`]: when `true`, imgproxy will always rasterize SVG images unless SVG processing is not [skipped](#skip-processing). Default: `false`
227232

228-
## AVIF/WebP support detection
233+
## AVIF/WebP/JPEG XL support detection
229234

230-
imgproxy can use the `Accept` HTTP header to detect if the browser supports AVIF or WebP and use it as the default format. This feature is disabled by default and can be enabled by the following options:
235+
imgproxy can use the `Accept` HTTP header to detect if the browser supports AVIF, WebP, or JPEG XL and use it as the default format. This feature is disabled by default and can be enabled by the following options:
231236

232237
* [`IMGPROXY_AUTO_WEBP`]: _(deprecated alias: [`IMGPROXY_ENABLE_WEBP_DETECTION`])_ enables WebP support detection. When the file extension is omitted in the imgproxy URL and browser supports WebP, imgproxy will use it as the resulting format.
233238
* [`IMGPROXY_ENFORCE_WEBP`]: enables WebP support detection and enforces WebP usage. If the browser supports WebP, it will be used as resulting format even if another extension is specified in the imgproxy URL.
234239
* [`IMGPROXY_AUTO_AVIF`]: _(deprecated alias: [`IMGPROXY_ENABLE_AVIF_DETECTION`])_ enables AVIF support detection. When the file extension is omitted in the imgproxy URL and browser supports AVIF, imgproxy will use it as the resulting format.
235240
* [`IMGPROXY_ENFORCE_AVIF`]: enables AVIF support detection and enforces AVIF usage. If the browser supports AVIF, it will be used as resulting format even if another extension is specified in the imgproxy URL.
241+
* [`IMGPROXY_AUTO_JXL`]: enables JPEG XL support detection. When the file extension is omitted in the imgproxy URL and browser supports JPEG XL, imgproxy will use it as the resulting format.
242+
* [`IMGPROXY_ENFORCE_JXL`]: enables JPEG XL support detection and enforces JPEG XL usage. If the browser supports JPEG XL, it will be used as the resulting format even if another extension is specified in the imgproxy URL.
236243

237244
:::info
238-
imgproxy prefers AVIF over WebP. This means that if both AVIF and WebP detection/enforcement are enabled and the browser supports both of them, AVIF will be used.
245+
If multiple format detection/enforcement options are enabled, and the browser supports multiple of them, imgproxy will use the format with the highest priority. The priority is as follows (from the highest to the lowest): JPEG XL, AVIF, WebP
239246
:::
240247

241248
:::info
242249
If both the source and the requested image formats support animation and AVIF detection/enforcement is enabled, AVIF won't be used as AVIF sequence is not supported yet.
243250
:::
244251

252+
:::info
253+
If both the source and the requested image formats support animation and JPEG XL detection/enforcement is enabled, JPEG XL won't be used as animated JPEG XL is not widely supported by browsers yet.
254+
:::
255+
245256
:::tip
246-
When AVIF/WebP support detection is enabled, please take care to configure your CDN or caching proxy to take the `Accept` HTTP header into account while caching.
257+
When AVIF/WebP/JPEG XL support detection is enabled, please take care to configure your CDN or caching proxy to take the `Accept` HTTP header into account while caching.
247258
:::
248259

249260
:::warning
@@ -265,7 +276,7 @@ imgproxy is guided by the following rules when choosing the resulting format:
265276
5. If none of the preferred formats meet the requirements, the first preferred format is used
266277

267278
:::info
268-
When AVIF/WebP support detection is enabled and the browser supports AVIF/WebP, it may be used as the resultant format even if the preferred formats list doesn't contain it.
279+
When AVIF/WebP/JPEG XL support detection is enabled and the browser supports AVIF/WebP/JPEG XL, it may be used as the resultant format even if the preferred formats list doesn't contain it.
269280
:::
270281

271282
## Skip processing

docs/features/autoquality.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ IMGPROXY_AUTOQUALITY_MAX=80
111111
# Quality 50 for AVIF is pretty the same as 80 for JPEG
112112
IMGPROXY_AUTOQUALITY_FORMAT_MIN="avif=40"
113113
IMGPROXY_AUTOQUALITY_FORMAT_MAX="avif=50"
114-
# Neural networks paths for JPEG, WebP, and AVIF
114+
# Neural networks paths for JPEG, WebP, AVIF, and JPEG XL
115115
IMGPROXY_AUTOQUALITY_JPEG_NET="/networks/autoquality-jpeg.pb"
116116
IMGPROXY_AUTOQUALITY_WEBP_NET="/networks/autoquality-webp.pb"
117117
IMGPROXY_AUTOQUALITY_AVIF_NET="/networks/autoquality-avif.pb"
118+
IMGPROXY_AUTOQUALITY_JXL_NET="/networks/autoquality-jxl.pb"
118119
```
119120

120121
:::info

docs/features/best_format.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ You can use the `best` value for the [format](../usage/processing.mdx#format) op
1010
imgproxy measures the complexity of the image to choose when it should use a lossless or near-lossless encoding. Then imgproxy tries to save the image in multiple formats to pick one with the smallest resulting size.
1111

1212
:::info
13-
imgproxy uses only the formats listed as [preferred](../configuration/options.mdx#preferred-formats) when choosing the best format. It may also use AVIF or WebP if [AVIF/WebP support detection](../configuration/options.mdx#avifwebp-support-detection) is enabled.
13+
imgproxy uses only the formats listed as [preferred](../configuration/options.mdx#preferred-formats) when choosing the best format. It may also use AVIF, WebP, or JPEG XL if [AVIF/WebP/JPEG XL support detection](../configuration/options.mdx#avifwebpjpeg-xl-support-detection) is enabled.
1414
:::
1515

1616
:::info
17-
imgproxy will use AVIF or WebP _only_ if [AVIF/WebP support detection](../configuration/options.mdx#avifwebp-support-detection) is enabled.
17+
imgproxy will use AVIF, WebP, or JPEG XL _only_ if [AVIF/WebP/JPEG XL support detection](../configuration/options.mdx#avifwebpjpeg-xl-support-detection) is enabled.
1818
:::
1919

2020
:::info

docs/image_formats_support.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ At the moment, imgproxy supports only the most popular image formats:
1010
| ----------------------------|-----------|--------------------------------|---------------------------|
1111
| PNG | `png` | :white_check_mark: | :white_check_mark: |
1212
| JPEG | `jpg` | :white_check_mark: | :white_check_mark: |
13+
| JPEG XL | `jxl` | :white_check_mark: | [See notes](#jxl-support) |
1314
| WebP | `webp` | :white_check_mark: | :white_check_mark: |
1415
| AVIF | `avif` | :white_check_mark: | :white_check_mark: |
1516
| GIF | `gif` | :white_check_mark: | :white_check_mark: |
@@ -22,6 +23,12 @@ At the moment, imgproxy supports only the most popular image formats:
2223
| MP4 (h264) ((pro)) | `mp4` | [See notes](#video-thumbnails) | :white_check_mark: |
2324
| Other video formats ((pro)) | | [See notes](#video-thumbnails) | :x: |
2425

26+
## JPEG XL support {#jxl-support}
27+
28+
imgproxy supports JPEG XL as a source format without limitations.
29+
30+
When JPEG XL is used as a result format, animations are not supported because animated JPEG XL is not yet supported by browsers.
31+
2532
## SVG support
2633

2734
imgproxy supports SVG sources without limitations, but SVG results are not supported when the source image is not SVG.

docs/usage/processing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ When using an encrypted source URL, you can specify the [extension](#extension)
11681168

11691169
Extension specifies the format of the resulting image. Read more about image formats support [here](../image_formats_support.mdx).
11701170

1171-
The extension can be omitted. In this case, imgproxy will use the source image format as resulting one. If the source image format is not supported as the resulting image, imgproxy will use `jpg`. You also can [enable AVIF or WebP support detection](../configuration/options.mdx#avifwebp-support-detection) to use it as the default resulting format when possible.
1171+
The extension can be omitted. In this case, imgproxy will use the source image format as resulting one. If the source image format is not supported as the resulting image, imgproxy will use `jpg`. You also can [enable AVIF, WebP, or JPEG XL support detection](../configuration/options.mdx#avifwebpjpeg-xl-support-detection) to use it as the default resulting format when possible.
11721172

11731173
### Best format ((pro))
11741174

0 commit comments

Comments
 (0)