#10003·parcel

Support JPEG XL

Author: solonovamaxCreated Nov 12, 2024Updated Sep 13, 2026

Feature Request

Suppory JPEG XL as an output format for images.

Expected Behavior

JPEG XL works

Current Behavior

JPEG XL does not work

Possible Solution

Support JPEG XL.

Context

Supporting JPEG XL requires sharp ≥0.31.3, as well as a custom lib-vips build.

See: https://sharp.pixelplumbing.com/api-output#jxl

supporting this should be somewhat straightforward and only require adding one (or two) lines to packages/transformers/image/src/ImageTransformer.js:

diff
 const FORMATS = new Map([
   ['jpeg', 'jpeg'],
   ['jpg', 'jpeg'],
   ['png', 'png'],
   ['webp', 'webp'],
   ['gif', 'gif'],
   ['tiff', 'tiff'],
   ['avif', 'avif'],
   ['heic', 'heif'],
   ['heif', 'heif'],
+  ['jpegxl', 'jxl'],
+  ['jxl', 'jxl'],
 ]);

Examples

xml
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>HTML Example</title>
  </head>
  <body>
    <picture>
      <source srcset="image.jpeg?as=avif&width=800" type="image/avif" />
      <source srcset="image.jpeg?as=jxl&width=800" type="image/jxl" />
      <source srcset="image.jpeg?as=webp&width=800" type="image/webp" />
      <source srcset="image.jpeg?width=800" type="image/jpeg" />
      <img src="image.jpeg?width=200" alt="test image" />
    </picture>
  </body>
</html>