Skip to content

Support JPEG XL #10003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
solonovamax opened this issue Nov 12, 2024 · 6 comments Β· May be fixed by #10015
Open

Support JPEG XL #10003

solonovamax opened this issue Nov 12, 2024 · 6 comments Β· May be fixed by #10015

Comments

@solonovamax
Copy link
Contributor

solonovamax commented Nov 12, 2024

πŸ™‹ 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>
@devongovett
Copy link
Member

Want to send a PR for that patch?

@solonovamax
Copy link
Contributor Author

Want to send a PR for that patch?

sure, I could do that. I just felt it wasn't worth a PR because it's such a tiny change.

solonovamax added a commit to solonovamax/parcel that referenced this issue Nov 18, 2024
@solonovamax solonovamax linked a pull request Nov 18, 2024 that will close this issue
3 tasks
@solonovamax
Copy link
Contributor Author

Opened a PR for the code changes (#10015), as well as a PR for the documentation changes (parcel-bundler/website#1112).

@solonovamax
Copy link
Contributor Author

Want to send a PR for that patch?

Any possibility of the pr(s) being merged any time soon, or no?

@omduggineni
Copy link

@solonovamax for what it's worth, the PR seems to be approved but is failing tests & therefore unmergable. Should I try to update/resubmit it? I'd also love to see JXL support in Parcel lol

@solonovamax
Copy link
Contributor Author

@solonovamax for what it's worth, the PR seems to be approved but is failing tests & therefore unmergable. Should I try to update/resubmit it? I'd also love to see JXL support in Parcel lol

it failed due to an issue with sharp.
that's because sharp could not find libvips of a new enough version, so it used the one it ships with, which does not have jxl support.

solonovamax added a commit to solonovamax/parcel that referenced this issue Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants