Skip to content

Add JPEG XL (JXL) support #76981

Open

Description

@adamsilverstein

Claude reworked this description around Jake Archibald's JXL vs AVIF research and the current state of #77584:

Overview

Add JPEG XL (JXL) support to client-side media processing. This was requested in #76756 by several community members.

The work is in #77584, with the server-side core backport in WordPress/wordpress-develop#12006.

What JXL offers, and what it doesn't

Jake Archibald compared JXL and AVIF for web use in https://jakearchibald.com/2026/jpeg-xl-vs-avif/ (October 2026, avifenc 1.4.2, libjxl 0.12.0 and the newer jixel encoder, scored with SSIMULACRA 2 and ColorVideoVDP). The headlines that matter for WordPress:

Where AVIF is better:

  • Lossy photos: the best JXL is typically 15-25% larger than the equivalent AVIF at default efforts, and 6-20% larger at maximum efforts. There are outliers where JXL wins, so it is not every image.
  • Screenshots and illustrations: JXL is 30-90% larger at default efforts.
  • Transparency: libjxl is 31-44% larger at default efforts.
  • Speed and memory: AVIF is generally faster to encode for the file size it produces, uses less memory, and decodes faster. JXL typically takes 2-3x as long to decode at medium quality.
  • HDR gain maps: the JXL format supports them, but no browser decodes them. Without gain maps the two metrics disagree a lot, though both put PQ JXL smaller than PQ AVIF.

Where JXL is better:

  • Lossless JPEG recompression: JXL can make existing JPEGs 9-20% smaller without further loss, and they decode as fast or faster (except small images). Add JPEG XL support #77584 does not use this - transcoding a JPEG to JXL in the upload pipeline decodes and re-encodes, so it is lossy.
  • Lossless images: JXL is the clear winner, though lossless is rarely what the web needs.
  • Progressive decoding: cheap with libjxl, and supported in Chrome and Firefox (Safari shows only the final image).

Two findings bear directly on the settings in #77584:

  • libjxl's higher efforts are much slower and barely improve the result, so the PR's effort 3 (chosen because libvips' default of 7 is too slow to wait on in the editor) should not give up much against higher efforts. It does sit below libjxl's default, so expect JXL output from the PR to land at or past the larger end of the gaps above.
  • Jake's own conclusion is to default to AVIF, and try JXL when AVIF produces an unusually large file.

A smaller check with WordPress's own settings agrees on the big picture. Encoding the 37 reference images from the AVIF quality benchmark (https://github.com/b1ink0/avif-quality-benchmark) with libjxl at effort 3 and quality 82, JXL scored about the same as JPEG 82 on SSIMULACRA 2 (median 78.8 vs 78.5) at 73% of the JPEG size. So JXL is a real improvement over JPEG at the WordPress default quality. Against the browser's AVIF at matched quality, photos came out closer to a tie than Jake found, and AVIF was again much smaller on diagrams and screenshots.

So the case for JXL in WordPress is not smaller files than AVIF. It is that browsers now display JXL, so sites and photographers that already work in JXL can upload it and get JXL sub-sizes, and that JXL is a clear step up from JPEG for anyone who picks it as an output format.

Browser support

Per https://caniuse.com/jpegxl (checked 2026-10-23):

  • Chrome: on by default since 155 (Chrome for Android since 156). 145 to 154 had it behind a flag.
  • Firefox: on by default since 158, desktop and Android.
  • Safari: partial support since 17, macOS and iOS.
  • Edge, Samsung Internet, Opera: not yet.

caniuse puts global support at roughly 60%. A JXL attachment has no fallback format, so visitors on an unsupported browser will not see the image. That is the main trade-off.

How #77584 works

  • JXL stays JXL. A .jxl upload is handled like a WebP or AVIF: the .jxl is the attachment, and its sub-sizes are generated as JXL in the browser with vips and sideloaded. It is no longer converted to JPEG the way HEIC is.
  • HDR originals kept as uploaded. 16-bit HDR and gain-map JXL uploads are stored byte for byte (covered by e2e tests), though browsers do not apply JXL gain maps yet.
  • JXL as an output format. A JPEG, PNG or WebP upload can be transcoded to JXL through image_editor_output_format.
  • Lazy-loaded decoder. vips-jxl.wasm ships as its own script module chunk (~850 kB gzipped) that the browser only fetches the first time a JXL is processed. Sessions that never touch JXL download nothing extra; the always-loaded cost is under 1 kB. This replaces the canonical plugin approach in Client-side media: Add JPEG XL (JXL) support via canonical plugin #76990, which put an install step in front of JXL and left non-admins without it, and the bundled approach in Client-side media: Bundle JPEG XL (JXL) support directly into Gutenberg #77570, which added the decoder to every editor load.
  • Server side. image/jxl is added to upload_mimes (the network's upload file types still decide whether it is allowed), a wp_check_filetype_and_ext filter sniffs the JXL magic bytes since fileinfo reports image/x-jxl, and a small header parser reads the width and height because getimagesize() cannot read JXL. The attachment metadata and the sideload endpoint use those dimensions.

Tasks

Open questions

  • How much browser support is enough to ship a format with no fallback? Edge is the largest holdout.
  • Is lossless JPEG recompression worth a follow up, as an opt-in for sites that upload a lot of JPEGs? It is the one place JXL clearly beats every other option for existing content.
  • When JXL is the output format, the full-size file stays in its original format (the same as for every other output format in client-side processing), and only the sub-sizes become JXL. Should converting the main file be a follow up for all formats?

Related

AI Use

Description written with 🤖 Claude Code, summarizing Jake Archibald's research plus a smaller check with WordPress's settings.

Activity

  1. added
    [Type] Enhancement
    [Feature] Client Side Media
    on Apr 1, 2026
  2. added a commit that references this issue on Apr 2, 2026
    b4d1028
  3. added
    [Status] In Progress
    on Apr 2, 2026
  4. changed the title [-]Client Side Media: Add JPEG XL (JXL) support[/-] [+]Add JPEG XL (JXL) support[/+] on Apr 2, 2026
  5. BlackStar1991 commented on Apr 11, 2026

    @BlackStar1991

    No one exept Safary support JXL . Very raw technology for 2026

  6. adamsilverstein commented on Apr 11, 2026

    @adamsilverstein
    MemberAuthor

    No one exept Safary support JXL . Very raw technology for 2026

    Good point. That's why we plan to only load the support for jxl when a user needs it, ie when they first try uploading one.

  7. moved this to 📋 Iteration/Tracking Issues in WordPress 7.1 Editor Taskson Apr 15, 2026
  8. moved this from 📋 Iteration/Tracking Issues to 🏗️ In Progress in WordPress 7.1 Editor Taskson Apr 21, 2026
  9. moved this from 🏗️ In Progress to 📋 Iteration/Tracking Issues in WordPress 7.1 Editor Taskson Apr 22, 2026
  10. adamsilverstein commented on Jun 24, 2026

    @adamsilverstein
    MemberAuthor

    Noting that we plan to hold off on landing JXL support for now and I have switched the PR to draft accordingly. I'm also removing this ticket from the 7.1 board and 7.1 iteration stack. The PR is still available for testing: #77584

  11. 11 remaining items

  12. nickchomey commented on Oct 27, 2026

    @nickchomey
    Contributor

    Oh neat, thanks for pointing that out. I'll take a closer look. I am curious to see how this compares to loading vips-jxl.wasm.

    Im also quite curious to see cpu and ram performance. It's a significantly smaller bundle too.

    It also needs to run a worker with our current queue mechanism, I'll check if it can do that.

    I don't see why not. It's just JS.

    possibly, we only support Chromium so far for client side media, but other browsers are getting there.

    My point was that this is JS-only, so seemingly all browsers could use it (unless it uses any apis that are not yet universal).

  13. adamsilverstein commented on Oct 27, 2026

    @adamsilverstein
    MemberAuthor

    @nickchomey I ran some numbers comparing rapier-jxl to the vips approach in #77584. Short version: it doesn't look like a better fit for us right now, mostly because it is encoder only.

    Claude ran the benchmarks and wrote up what it found:

    The setup: rapier-jxl 6.1.0 (rapier-jxl/photo) vs wasm-vips 0.0.19 jxlsave with the settings #77584 uses (Q: 82, effort: 3), both in Node 20 on an Apple M5, median of 3 runs, each run in its own process for peak RSS. Images: 6 Kodak photos (768x512), one 1536x1152 sub-size and two 12 MP photos. Quality was scored with libjxl's ssimulacra2 after decoding with djxl. Rapier's quality scale runs lower than libjxl's (q82 scores ~69 vs ~79 for vips Q82), so sizes are compared at the same SSIMULACRA2 score, not the same quality number.

    Image vips e3 (#77584) rapier e3, same score rapier e7 q90 (score within ~1.5)
    Kodak 768x512 (avg of 6) 70 KB, 33 ms +1.9% size, 192 ms (~6x) -5 to -10% size, 474 ms (~14x)
    1536x1152 288 KB, 89 ms +0.9% size, 466 ms (~5x) -9% size, 1.6 s (~18x)
    12 MP photo A 1,363 KB, 422 ms +4.5% size, 3.4 s (~8x) -1.5% size, 6.8 s (~16x)
    12 MP photo B 2,046 KB, 333 ms +4.7% size, 2.4 s (~7x) -2.5% size, 5.7 s (~17x)
    • Size: at a comparable effort rapier is 1-5% larger. Its claimed wins show up at effort 7, where it is 2-10% smaller than vips e3, but 14-18x slower. vips' own effort 7 is about 5x slower than e3 for a similar gain, which is why the PR uses e3.
    • Speed: vips is 5-8x faster at e3. A 12 MP encode takes 2.4-3.4 s with rapier on a fast laptop vs ~0.4 s with vips, and the upload queue encodes several sub-sizes per image.
    • Memory: peak RSS for a 12 MP encode is ~1.4 GB for rapier vs ~0.94 GB for single-threaded vips. For small images rapier is far lighter (115 MB vs 350 MB), but that is mostly the vips runtime, which the media worker loads for every upload anyway, so rapier would add memory on top of it, not replace it.
    • Bundle size: this is where rapier shines. The photo encoder is 61 KB gzipped vs 793 KB for vips-jxl.wasm. Add JPEG XL support #77584 already lazy-loads the vips chunk only on first JXL use though, so non-JXL sites pay nothing either way.
    • No decoder: rapier only encodes. For a .jxl upload we still need to decode it to make sub-sizes, so it can't replace vips-jxl.wasm unless we rely on the browser's native decoder. Chrome 156 decodes rapier output fine (within ±1 of djxl on every test file), but Edge and the Playwright Chromium used in CI can't decode JXL, so we would lose sub-sizes there.
    • Maturity: the repo is about four weeks old with six major versions in that time and a single maintainer. Worth watching, but early for something every upload goes through.

    On encoding in browsers that don't support JXL: the vips approach already does that, since the encoder is WebAssembly and doesn't depend on browser support. Displaying the result still needs browser support either way.

    The license is fine: rapier-jxl is MIT, and the libjxl-derived parts it credits are BSD-3-Clause. Both are GPL-compatible.

    Unless rapier gets a lot faster at its higher efforts, I'm inclined to stick with vips for now especially since we already use it. Running the code in WASM has some structural advantages as well.

  14. nickchomey commented on Oct 27, 2026

    @nickchomey
    Contributor

    That all makes sense. I agree. Thanks for checking it out!

  15. jackskip22 commented on Oct 28, 2026

    @jackskip22

    @nickchomey I ran some numbers comparing rapier-jxl to the vips approach in #77584. Short version: it doesn't look like a better fit for us right now, mostly because it is encoder only.

    Claude ran the benchmarks and wrote up what it found:

    The setup: rapier-jxl 6.1.0 (rapier-jxl/photo) vs wasm-vips 0.0.19 jxlsave with the settings #77584 uses (Q: 82, effort: 3), both in Node 20 on an Apple M5, median of 3 runs, each run in its own process for peak RSS. Images: 6 Kodak photos (768x512), one 1536x1152 sub-size and two 12 MP photos. Quality was scored with libjxl's ssimulacra2 after decoding with djxl. Rapier's quality scale runs lower than libjxl's (q82 scores ~69 vs ~79 for vips Q82), so sizes are compared at the same SSIMULACRA2 score, not the same quality number.

    Image
    vips e3 (#77584)
    rapier e3, same score
    rapier e7 q90 (score within ~1.5)

    Kodak 768x512 (avg of 6)
    70 KB, 33 ms
    +1.9% size, 192 ms (~6x)
    -5 to -10% size, 474 ms (~14x)

    1536x1152
    288 KB, 89 ms
    +0.9% size, 466 ms (~5x)
    -9% size, 1.6 s (~18x)

    12 MP photo A
    1,363 KB, 422 ms
    +4.5% size, 3.4 s (~8x)
    -1.5% size, 6.8 s (~16x)

    12 MP photo B
    2,046 KB, 333 ms
    +4.7% size, 2.4 s (~7x)
    -2.5% size, 5.7 s (~17x)

    • Size: at a comparable effort rapier is 1-5% larger. Its claimed wins show up at effort 7, where it is 2-10% smaller than vips e3, but 14-18x slower. vips' own effort 7 is about 5x slower than e3 for a similar gain, which is why the PR uses e3.
    • Speed: vips is 5-8x faster at e3. A 12 MP encode takes 2.4-3.4 s with rapier on a fast laptop vs ~0.4 s with vips, and the upload queue encodes several sub-sizes per image.
    • Memory: peak RSS for a 12 MP encode is ~1.4 GB for rapier vs ~0.94 GB for single-threaded vips. For small images rapier is far lighter (115 MB vs 350 MB), but that is mostly the vips runtime, which the media worker loads for every upload anyway, so rapier would add memory on top of it, not replace it.
    • Bundle size: this is where rapier shines. The photo encoder is 61 KB gzipped vs 793 KB for vips-jxl.wasm. Add JPEG XL support #77584 already lazy-loads the vips chunk only on first JXL use though, so non-JXL sites pay nothing either way.
    • No decoder: rapier only encodes. For a .jxl upload we still need to decode it to make sub-sizes, so it can't replace vips-jxl.wasm unless we rely on the browser's native decoder. Chrome 156 decodes rapier output fine (within ±1 of djxl on every test file), but Edge and the Playwright Chromium used in CI can't decode JXL, so we would lose sub-sizes there.
    • Maturity: the repo is about four weeks old with six major versions in that time and a single maintainer. Worth watching, but early for something every upload goes through.

    On encoding in browsers that don't support JXL: the vips approach already does that, since the encoder is WebAssembly and doesn't depend on browser support. Displaying the result still needs browser support either way.
    The license is fine: rapier-jxl is MIT, and the libjxl-derived parts it credits are BSD-3-Clause. Both are GPL-compatible.

    Unless rapier gets a lot faster at its higher efforts, I'm inclined to stick with vips for now especially since we already use it. Running the code in WASM has some structural advantages as well.

    Thanks for trying rapier-jxl! I just pushed 7.0 which is much better for upload queues and finalizes the API. In Chrome, encoding WordPress uploads at the same quality as vips Q82 effort 3 takes about 0.4x the time with about 2% smaller files. I’m working on more optimizations for 7.0.1 now. Opt-in acceleration runs heavy work in WebAssembly SIMD with a plain JavaScript fallback and it doesn’t need SharedArrayBuffer.

    For your PR, vips would keep resizing, rapier-jxl does JXL encoding and the browser decodes JXL uploads. Then JXL uploads after the first one finish in about 0.7x the time in your queue. 7.0 also has a fallback decoder for Edge, Playwright’s Chromium and older browsers. Its JXL code including the decoder is under 200 KB gzipped vs. about 850 KB for the vips JXL module.

    When I was testing, wasm-vips 0.0.19 couldn’t open JXL files with Brotli-compressed XMP which cjxl writes by default. But Chrome and djxl can open them fine.

    Feel free to reach out with any requests. I’m working on tuning each effort level for different use cases.

  16. nickchomey commented on Oct 28, 2026

    @nickchomey
    Contributor

    @jackskip22 can I suggest releases, tags or at least a changelog? It would be useful to seeing changes across versions (as well as even noticing that there are new versions)

    Edit: I now see that it is evolving very quickly - 3 major versions in a week! Still, it would be useful to note the major changes per version - so we can learn what you've learned, and see how it affects the api etc

  17. jackskip22 commented on Oct 28, 2026

    @jackskip22

    30. @jackskip22 can I suggest releases, tags or at least a changelog? It would be useful to seeing changes across versions (as well as even noticing that there are new versions)
    Edit: I now see that it is evolving very quickly - 3 major versions in a week! Still, it would be useful to note the major changes per version - so we can learn what you've learned, and see how it affects the api etc

    On it! v7 is the first release in the permanent shape after much experimentation - I'll make it easier to follow now. Will push 7.0.1 later with changelog, tags and releases

  18. adamsilverstein commented on Oct 28, 2026

    @adamsilverstein
    MemberAuthor

    @jackskip22 thanks for stopping by and for the updates!

    We aren't quite ready to merge JXL support so I will continue to monitor your effort and compare it to the vips alternative for our needs.

  19. nekohayo commented on Nov 23, 2026

    @nekohayo

    For the record, as mentioned in WordPress/performance#12 (comment) :

    JPEG XL is supported by default in the stable released versions of:

    • Safari/iOS (since 17) and anything WebKit-based (including the world-famous GNOME Web, of course ;)
    • Firefox 158
    • Chrome 155/156

    On the desktop, Edge has about 13% marketshare according to https://gs.statcounter.com/browser-market-share/desktop/worldwide/#monthly-202001-202611, but it's the only holdout that is not entirely negligible.

    On mobile, Chrome + Safari (+ Firefox) together hold over 92% marketshare according to https://gs.statcounter.com/browser-market-share/mobile/worldwide#monthly-202001-202611

    Maybe you (Wordpress) signalling your intent to ship JPEG XL (at least as a beta feature), given your heavy influence on the web, would be something you could bring up in a conversation with Microsoft (certainly at least someone in your organization has some contacts over there) to motivate them to ship it in Edge faster.

  20. adamsilverstein commented on Nov 23, 2026

    @adamsilverstein
    MemberAuthor

    Thanks for the update @nekohayo - great to see the growing support. Any idea why Edge is holding out on JXL support?

    If you want to give the PR a test, your feedback would be helpful: #77584 (click the Playground link in the description to run the PR in your browser and try uploading and using a JXL)

  21. nickchomey commented on Nov 23, 2026

    @nickchomey
    Contributor

    I couldn't find anything about edge holding out. Here's their issue tracker item.

    https://feedbackportal.microsoft.com/feedback/idea/5995d056-50b6-f011-aa44-7c1e5298a4a1

  22. jackskip22 commented on Nov 23, 2026

    @jackskip22

    I think the main barriers for JXL adoption are device support and nobody knowing about it. Automatic fallbacks are easy on the web. Sub-sizes can keep JPEG or WebP copies with each JXL, or sites that only want to store JXL can use a WebAssembly decoder to show JXL images in Edge and older browsers, like JPEG XL polyfill.
    Windows has Microsoft's JPEG XL Image Extension and Apple devices already support viewing JXL images. But Android's Gallery and Google Photos do not support it yet. Animated JXL is becoming popular to save storage space on GIFs but Safari doesn't play animated JXL yet, so apps and sites need animated PNG or animated WebP fallbacks for now.

  23. adamsilverstein commented on Nov 23, 2026

    @adamsilverstein
    MemberAuthor

    I think the main barriers for JXL adoption are device support and nobody knowing about it. Automatic fallbacks are easy on the web. Sub-sizes can keep JPEG or WebP copies with each JXL, or sites that only want to store JXL can use a WebAssembly decoder to show JXL images in Edge and older browsers, like JPEG XL polyfill.

    Fallbacks may be technically easy, but they are difficult to understand for average users. When users upload images to their website, they just want them to work - they don't care about the underly "codec" - they might care about the image quality or whether their full HDR image is displaying properly. Image formats though are an implementation detail only technologists like ourselves really care about.

    Even when we reach the point that all web browsers support a given format (eg. WebP), there can still be considerable friction to user adoption: for example, you may be unable to share a WebP image you download from a website in a Google Doc (Docs doesn't support webp), or it might not show up in your social feeds (facebook doesn't support webp images in the Open Graph tag).

    All that said, once JXL support ships in Edge, we will have met all the requirements for WordPress to ship support here.

  24. wadetregaskis commented on Nov 23, 2026

    @wadetregaskis

    Could JPEG XL support be added in "preview" now, until Edge catches up?

    It's no big issue to me if I have to turn JPEG XL on in the WordPress settings. It's significantly more irritating - and error-prone - if I have to write a custom plug-in to do it. Which I've done, now, but others could be saved the hassle.

    (and I had to do the same thing for AVIF not that long ago, so I'm vaguely familiar with the process - most people aren't)

    FWIW in my experiments so far with JPEG XL it offers only similar compression efficiency to AVIF on average (but notably better for lossless and 'graphics' like screenshots) but with the big advantage that it's up to an order of magnitude faster at encoding. To me that's important - end-users aren't likely to sit there for several minutes waiting for an AVIF encode, but they might tolerate ten seconds for a JPEG XL encode, that yields essentially the same effect. It'll also help with thumbnail generation etc, in making WordPress a bit more responsive.

  25. adamsilverstein commented on Nov 23, 2026

    @adamsilverstein
    MemberAuthor

    Could JPEG XL support be added in "preview" now, until Edge catches up?

    The only real mechanism we have for this is Gutenberg Experiments, which is more for testing new proposed features.

    I'm hopeful Edge support will catch up soon and WordPress will decide to add support, for now a plugin is still the best route.

  26. nickchomey commented on Nov 23, 2026

    @nickchomey
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[Feature] Client Side Media[Type] Enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions