Skip to content

Support JPEG XLΒ #10003

Open
Open
@solonovamax

Description

@solonovamax

πŸ™‹ 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:

 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

<!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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions