Skip to content
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

Support JPEG XL #10003

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

Support JPEG XL #10003

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

Comments

@solonovamax
Copy link

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

Want to send a PR for that patch?

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

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.

2 participants