Skip to content

Add JPEG XL support - #77584

Open
adamsilverstein wants to merge 76 commits into
trunkfrom
try/jxl-lazy-load
Open

adamsilverstein wants to merge 76 commits into
trunkfrom
try/jxl-lazy-load

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented Apr 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds JPEG XL (JXL) support to client-side media processing, without making every editor page download a JXL decoder it will probably never use.

A JXL upload is treated like any other image the browser can process: the .jxl itself becomes the attachment, and vips generates its sub-sizes as JXL in the browser, since the server cannot read JXL without GD/Imagick JXL support. Chrome 155 and Firefox 158 display JXL by default and Safari has partial support since 17, so there is no longer a reason to convert it to JPEG the way HEIC is. JXL also becomes an available output format, so an uploaded JPEG/PNG/WebP can be transcoded to JXL on the way in.

On size: JXL is not a smaller AVIF. Jake Archibald's comparison (https://jakearchibald.com/2026/jpeg-xl-vs-avif/) finds lossy JXL photos are typically 15-25% larger than the equivalent AVIF at default efforts, and screenshots and illustrations 30-90% larger. libjxl's higher efforts barely help, and JXL is slower to decode. Where JXL does win is lossless images and repacking existing JPEGs 9-20% smaller without further loss, which this PR does not do yet. The case for this PR is that browsers now display JXL, so sites that already have JXL files can upload them, not that JXL saves bytes over AVIF. More detail in #76981.

The JXL WASM decoder (~850 kB gzipped) lives in its own script module chunk that the browser only fetches the first time a JXL image is actually processed. Editor sessions that never touch JXL transfer no extra bytes.

Fixes #76981.

Core backport: WordPress/wordpress-develop#12006

How it works

The lazy chunk. packages/vips/src/jxl-wasm.ts is a tiny script module that exports the inlined bytes of wasm-vips/vips-jxl.wasm. It is listed in wpScriptModuleExports so the build emits a standalone build/modules/vips/jxl-wasm.min.js, and @wordpress/vips/worker declares it as a dynamic module_dependencies entry so WordPress's import map can resolve it at runtime.

Getting the bytes to the worker. vipsEnsureJxlSupport() on the main thread dynamic-imports that module - which is what triggers the download - and hands the bytes to the worker through a new setJxlWasm() RPC. It transfers a bare ArrayBuffer rather than the typed array: comctx only fast-paths ArrayBuffer and Array and walks anything else key by key, which for a multi-megabyte typed array means millions of main-thread allocations per call. The download is cached, and the RPC repeats only when the worker has been recycled since the last call.

Worker-side reinit. The worker stores the bytes and adds vips-jxl.wasm to dynamicLibraries on the next getVips(). If vips was already running without JXL, that instance is shut down first (it holds a large WASM heap that would otherwise be stranded for the life of the worker) and recreated with JXL support. locateFile wraps the bytes in a Blob URL when vips asks for vips-jxl.wasm. JXL encoding uses effort=3 - libvips' default of 7 is too slow to sit through interactively.

Upload path. image/jxl joins the vips-processable MIME types, so a JXL takes the same path as a WebP or AVIF: the original is uploaded with generate_sub_sizes off and generateThumbnails() sideloads JXL sub-sizes. A .jxl whose File.type comes back empty, as it does on a lot of systems, is re-labelled image/jxl first. The upload-media vips wrappers (resize, rotate, convert, compress) call vipsEnsureJxlSupport() whenever they read or write JXL, and hold the worker while they do, so a recycle cannot drop the JXL library in between. That also covers transcoding to JXL, where the server picks the output format after the upload response comes back. The big image threshold check reads a JXL's width and height from the server's attachment metadata instead of createImageBitmap(), since browsers without JXL support (including the Chromium used in CI) cannot decode it, and a failed read now skips the scaled version instead of leaving the upload stuck.

Server side. lib/media/load.php registers image/jxl in upload_mimes; core has no JXL entry, so without it the allowed-types check rejects the file. fileinfo reports JXL as image/x-jxl, so a wp_check_filetype_and_ext filter sniffs the magic bytes - both the naked codestream and the ISOBMFF container - and restores the expected extension and type.

getimagesize() cannot read JXL either, so gutenberg_get_jxl_info() decodes the width and height from the codestream SizeHeader (swapping them for transposing orientations). A wp_generate_attachment_metadata filter uses it to record the upload's dimensions, which core needs to report the missing sub-sizes, and the sideload endpoint falls back to it when checking each JXL sub-size.

Bundle size

From the size bot on the latest run:

Artifact Gzipped Change When loaded
build/modules/vips/jxl-wasm.min.js 850 kB new file On first JXL use only
build/modules/vips/worker.min.js 3.69 MB +475 B Always
build/scripts/upload-media/index.min.js 16.7 kB +245 B Always

The always-loaded cost is about 720 bytes. The 850 kB is paid once, on demand, and then cached.

Note the chunk is the vips-jxl.wasm dynamic library inlined into a JS module, so it transfers somewhat heavier than the raw .wasm would. See the discussion below on lighter-weight alternatives.

Screencast

jxl.to.jpeg.on.upload.mp4

Testing instructions

Test in WordPress Playground

  1. Open the editor with DevTools on the Network tab and upload a JPEG. There should be no request for jxl-wasm.min.js at all.
  2. Now upload a .jxl image. jxl-wasm.min.js is fetched once, and the block shows the image (in Chrome 155+, Firefox 158+ or Safari 17+; older browsers cannot display JXL).
  3. Upload a second .jxl and then another JPEG in the same session. No second fetch, and both process normally on the JXL-enabled vips instance.
  4. Check the attachment: /wp-json/wp/v2/media/<id> should report mime_type of image/jxl, the real width and height, and every entry in media_details.sizes should be a .jxl with mime_type of image/jxl.
  5. Delete the attachment and confirm the .jxl and its sub-sizes are removed from disk.
  6. Configure JXL as an output format (eg. JPEG to JXL via image_editor_output_format) and upload a JPEG. The sub-sizes should be .jxl files. The full-size file stays a JPEG, the same as for every other output format in client-side processing.
  7. Upload JPEG, PNG, WebP, AVIF, GIF and HEIC and confirm nothing has changed for them.
  8. Verify build/modules/vips/worker.min.asset.php declares a dynamic module_dependencies entry on @wordpress/vips/jxl-wasm.

Test files: any .jxl will do, or 200x150_e2e_test_image_decode.jxl in test/e2e/assets/.

Tests

  • e2e in client-side-media-processing.spec.js: a JXL upload and its sub-sizes stay JXL with the right dimensions, and the upload is stored byte for byte; a .jxl the browser reports no MIME type for is still processed; a JXL over the big image threshold gets a -scaled.jxl, with createImageBitmap stubbed out to stand in for a browser that cannot decode JXL; a transparent JXL keeps its alpha in the sub-sizes; JXL to JPEG and JPEG to JXL output format mapping convert the sub-sizes, and a transparent JXL keeps JXL sub-sizes when mapped to JPEG; a site that disallows JXL rejects the upload; several JXLs uploaded together alongside a JPEG all process.
  • PHPUnit in phpunit/media/gutenberg-get-jxl-info-test.php covers the dimension parser (naked codestream, jxlc and split jxlp containers, div8 sizes, orientation, truncated and non-JXL input), and gutenberg-filter-jxl-filetype-and-ext-test.php the file type filter's edge cases.
  • Unit tests in packages/vips/src/test/ cover what e2e cannot reach: the worker reinit (rebuild with JXL, reuse, recover from a failed init, keep a retired instance alive while in use) and vipsEnsureJxlSupport (download and send once, re-send after a worker recycle, retry a failed download or hand-off). packages/upload-media/src/store/utils/test/vips-worker-recycle.ts checks the worker is not recycled under a vips call in flight.

History

This was the third of three approaches tried for #76981, and the one that stuck. The other two are closed:

Splitting the decoder into its own on-demand chunk gets the "no cost unless you use it" property of the plugin approach without the install step.

AI Use

Code and description both written with 🤖 Claude Code. I will review and test.

Add client-side JPEG XL support without growing the vips worker
bundle. The 3 MB vips-jxl.wasm module is split into its own
@wordpress/vips/jxl-wasm script module that is only fetched the
first time a JXL image is processed.

How it works:
- packages/vips/src/jxl-wasm.ts is a tiny new script module whose
  only job is to export the base64 data URL for vips-jxl.wasm.
- @wordpress/vips/jxl-wasm is registered as a new wpScriptModuleExports
  entry so the build emits build/modules/vips/jxl-wasm.min.js (~3 MB)
  as a separately loadable module.
- vips-worker.ts adds vipsEnsureJxlSupport(), which on first call
  dynamic-imports '@wordpress/vips/jxl-wasm' to get the data URL,
  then RPC-passes it to the worker via setJxlWasmUrl().
- The worker (packages/vips/src/index.ts) stores the URL, adds
  vips-jxl.wasm to dynamicLibraries on the next getVips() call, and
  returns the URL from locateFile(). If vips was already initialized
  without JXL, the existing instance is discarded so the reinit picks
  up JXL support.
- packages/upload-media calls vipsEnsureJxlSupport() from prepareItem
  whenever the input or output type is image/jxl. image/jxl is added
  to CLIENT_SIDE_SUPPORTED_MIME_TYPES and 'jxl' to VALID_IMAGE_FORMATS
  and the ImageFormat type. The vipsConvertImageFormat wrapper MIME
  union is widened accordingly.
- JXL encoding uses effort=3 (libvips default 7 is too slow for
  interactive use).

Size impact:
- worker.min.js: unchanged (~13.1 MB, same as trunk).
- jxl-wasm.min.js: new separate module (~3.0 MB), fetched only when
  a JXL image is encountered.

Alternative to #77570, which bundles vips-jxl.wasm directly into the
worker (+3 MB on every editor page load). Opened so the size bot can
compare.

Refs #76981.
@github-actions

github-actions Bot commented Apr 23, 2026 •

Copy link
Copy Markdown

Size Change: +850 kB (+10.74%) ⚠️

Total Size: 8.76 MB

📦 View Changed
Filename Size Change
build/modules/vips/jxl-wasm.min.js 850 kB +850 kB (new file) 🆕
build/modules/vips/worker.min.js 3.69 MB +478 B (+0.01%)
build/scripts/upload-media/index.min.js 16.5 kB +237 B (+1.45%)

compressed-size-action

@github-actions

github-actions Bot commented Apr 23, 2026 •

Copy link
Copy Markdown

Flaky tests detected in 4ce3bac.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33117672777
📝 Reported tests:

Navigates the items list via UP/DOWN arrow keys in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByLabel('Page Two')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" with timeout 5000ms
  - waiting for getByLabel('Page Two')
    14 × locator resolved to <button type="button" tabindex="-1" aria-pressed="false" id="view-list-0-230-item-wrapper" class="dataviews-view-list__item" aria-labelledby="view-list-0-230-label" aria-describedby="view-list-0-230-description"></button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:112:49

Resolve conflict in packages/upload-media/src/store/private-actions.ts:
trunk moved image format transcoding from client-side prepareItem to
server-driven thumbnail generation. Adopt the new pipeline and keep
the JXL WASM lazy-load, but trigger it in two places: prepareItem for
JXL input files, and transcodeImageItem for server-requested JXL
output.
@adamsilverstein adamsilverstein self-assigned this Apr 28, 2026
@adamsilverstein
adamsilverstein requested review from andrewserong and youknowriad and removed request for youknowriad April 28, 2026 17:43
@adamsilverstein adamsilverstein added [Status] In Progress Tracking issues with work in progress [Type] Feature New feature to highlight in changelogs. [Feature] Client Side Media Media processing in the browser with WASM labels May 18, 2026
@adamsilverstein

Copy link
Copy Markdown
Member Author

A few notes from a review pass:

Bundle size / lighter-weight JXL options (re #76981)

  • The size bot reports gzip, so the headline +1.1 MB is the gzipped chunk, not the 3 MB raw figure. Updated the description's table to show both.
  • vips-jxl.wasm is 2.22 MB raw / 0.77 MB gzip. Base64-inlining it into a JS module bumps the gzip transfer to ~1.1 MB (+~0.33 MB). Cheapest same-architecture trim would be serving the raw .wasm instead of base64 — though I know we inline deliberately to avoid host MIME/path issues, so that's a tradeoff.
  • mediabunny doesn't help here — it's a video/audio toolkit, no still-image/JXL path.
  • jSquash @jsquash/jxl (standalone libjxl) is smaller — enc 0.49 MB / dec 0.30 MB gzip — but it's a second WASM runtime. We'd lose the single libvips pipeline (decode → resize → thumbnails → metadata → encode) and have to shuttle raw pixels between two heaps. Not worth it unless JXL were the only format we processed. The 3 MB is inherent to libjxl regardless of wrapper; the real win is keeping it lazy, which this PR does.
  • No browser encodes JXL (and WebCodecs has none), so a WASM encoder is unavoidable for now — which favors lazy-load over bundling.

Minor code note

  • In getVips(), the JXL reinit path (vipsPromise = undefined) orphans the previously-initialized vips instance without an explicit teardown (cleanup is the Emscripten auto-delete delay fn, not a heap teardown). It's bounded — only fires when a non-JXL image is processed before a JXL one in the same session, and only once — but given the prior OOM history (Investigate and fix crashes and console errors during client-side image upload processing #76706) a brief comment acknowledging it would help.

@adamsilverstein
adamsilverstein requested a review from ramonjd May 21, 2026 17:05
JXL is not broadly web-compatible: most browsers (including Chrome) cannot
display it and the server cannot read it (GD/Imagick have no JXL decoder, and
fileinfo reports it as image/x-jxl). Uploading JXL as-is was rejected outright
— by the editor's allowed-MIME check and by core's wp_check_filetype_and_ext()
— and even when allowed produced an undisplayable attachment with no
dimensions or sub-sizes.

Decode JXL to JPEG client-side with vips (the JXL WASM module is already
lazy-loaded on demand) and upload the JPEG, mirroring how HEIC is handled. The
original .jxl is preserved as a companion file in $metadata['original'] so no
data is lost. The editor and front end now use the portable JPEG, with real
dimensions and the full set of sub-sizes.

- Register image/jxl as an allowed upload MIME type, and restore the type
  during validation via a magic-byte-checked wp_check_filetype_and_ext filter
  so the sideloaded original passes despite the image/x-jxl finfo mismatch.
- Add original-jxl sideload handling to the REST controller, skipping the
  dimension read since JXL cannot be measured server-side.
- Generalize the HEIC companion delete hook to clean up JXL originals too.
- Add an e2e test and JXL asset covering the conversion and companion.
# Conflicts:
#	packages/upload-media/src/store/private-actions.ts
@adamsilverstein

Copy link
Copy Markdown
Member Author

I did some testing on this feature, made some small fixes and got it working, it now properly handles uploaded JXL files.

I created a JXL using Squoosh for testing:
Cliff-Palace.jxl.zip

Because JPEG XL (JXL) is not supported in Chromium where client-side media is active, and generally to provide a web-safe format for users, I decided to treat JXL uploads similar to HEIC uploads.

So we do the following:

  1. sideload the original JXL upload so it is preserved for the user
  2. output encode as JPEG for all display (sub) sizes, jpeg gets used on the front end/srcset and editor views.

The output format should also honor the image_output_formats filter, so JXL output will still be possible, just not the default.

See screencast:

jxl.to.jpeg.on.upload.mp4

@adamsilverstein

Copy link
Copy Markdown
Member Author

I will work on a core backport once the core client-side media feature is restored.

# Conflicts:
#	packages/vips/CHANGELOG.md
#	packages/vips/README.md
@adamsilverstein adamsilverstein changed the title Client-side media: Lazy-load JPEG XL (JXL) WASM on demand Add JPEG XL support, loaded on demand May 28, 2026
adamsilverstein and others added 7 commits October 22, 2026 13:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AcYRm3egtiB9yfX1VFaatb
Without generate_sub_sizes set to false, the server's check for image
types it cannot resize rejected the upload before the file type check
the test is about could run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AcYRm3egtiB9yfX1VFaatb
7.2 is in beta, so the core backport targets the next release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AcYRm3egtiB9yfX1VFaatb
# Conflicts:
#	packages/upload-media/CHANGELOG.md
#	packages/vips/CHANGELOG.md
Keeping JXL uploads in their own format means the server has to record
their width and height and accept their sub-size sideloads, but
getimagesize() cannot read JXL. Parse the codestream SizeHeader instead,
for the attachment metadata and the sideload endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
Chrome 155 and Firefox 158 now display JPEG XL, so there is no longer a
reason to convert JXL uploads to JPEG and keep the original on the side.
Treat JXL like any other vips-supported image: upload it as-is and
generate its sub-sizes as JXL on the client. The vips wrappers load JXL
support whenever they read or write JXL, holding the worker so a
recycle cannot drop it in between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
The e2e tests asserted the old JPEG conversion and companion original.
Check instead that the upload and its sub-sizes are JXL, that HDR and
gain-map uploads are stored byte-for-byte, and that transparency carries
into the sub-sizes. The test browser cannot display JXL yet, so these
tests no longer wait for the image to render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
@adamsilverstein

adamsilverstein commented Oct 24, 2026 •

Copy link
Copy Markdown
Member Author

Browser support for JXL has moved a lot since I wrote #77584 (comment), enough that converting JXL uploads to JPEG no longer makes sense. I've switched this PR to treat JXL like any other image: the upload and all of its sub-sizes stay JXL.

Claude pulled together where browsers stand today, and what changed in the PR:

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

  • Chrome: on by default since 155 (stable early October 2026), using the Rust jxl-rs decoder. 145-154 had it behind a flag. Chrome for Android from 156.
  • 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%, and the major engines are all moving the same way.

What changed in the PR:

  • image/jxl is now a regular vips-processable type, so a JXL upload takes the same path as WebP or AVIF: the .jxl is the attachment, and its sub-sizes are generated as JXL in the browser. No JPEG derivative, no source_original companion.
  • The server still cannot read JXL, so gutenberg_get_jxl_info() decodes the width and height from the codestream header. That fills in the attachment metadata (core needs it to report missing sub-sizes) and backs the sideload endpoint's dimension check.
  • The vips wrappers load JXL support whenever they read or write JXL, so resize, rotate and transcode all work on JXL sources.

The trade-off: visitors on Edge, Samsung Internet, Opera, or an older Chrome or Firefox won't see these images until their browser catches up.

The core backport in WordPress/wordpress-develop#12006 will need the same change.

adamsilverstein and others added 7 commits October 23, 2026 18:10
The JXL upload_mimes filter ran after core's check_upload_mimes(), so it
added JXL back on networks whose upload file types leave it out. Register
it first. Also accept untyped arguments in the filetype filter, since core
does not type them and some callers pass null, and reuse the codestream
reader for the JXL sniff instead of a second copy of the signatures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
The recycle guard only knew about ResizeCrop, Rotate and JXL work, so a
transcode, transparency check or UltraHDR probe could have its worker
terminated mid-call and never settle. Route every vips wrapper through
withVipsWorkerHeld instead of special-casing JXL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
The recipient was only recorded after the RPC resolved, so several JXL
operations starting together each copied and transferred the ~3 MB
library. Share the pending hand-off, and drop it if it fails so the next
call retries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
A failed JXL-enabled init kept the JXL bytes, so every later operation,
JPEG and PNG included, retried the broken library. Retired instances were
only shut down once no operation at all was running, so a busy batch kept
the old WASM heap alive next to the new one. And encodePixelsAsJpeg never
held its instance, so it could be shut down under it.

Lease an instance per operation instead: each instance counts its own
users and shuts down as soon as it is retired and idle. Only JXL work
retires a plain instance, and after a failed JXL init other work starts a
plain instance while JXL work keeps retrying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
The test plugin removed JXL at priority 20, after Gutenberg's filter
whatever its priority, so it could not catch Gutenberg adding JXL back
after check_upload_mimes(). Use the default priority, as core does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
Add a REST test for the sideload endpoint reading a JXL sub-size's
dimensions. The empty-container test went through
wp_check_filetype_and_ext(), where fileinfo already recognises the JXL
ftyp box, so check gutenberg_is_jxl_file() directly instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
The big image threshold check decoded the source with createImageBitmap,
which rejects for JXL in browsers without JXL support. The rejection
stranded the upload in the queue, so every JXL e2e test timed out. Use the
dimensions the server read from the JXL header instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uBiB3PfgBJpX6dbD1mN4B
# Conflicts:
#	packages/upload-media/CHANGELOG.md
#	packages/upload-media/src/store/private-actions.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Changes are needed because JXL header parsing can fabricate dimensions from truncated or fragmented data, and JPEG-to-JXL conversion leaves smaller main attachments unchanged when server encoding is unavailable.

3 open issues
What changed in this PR

Adds JPEG XL support to Gutenberg’s client-side media pipeline, loading the decoder only when needed rather than increasing every editor session’s download.

Changes:

  • Adds a lazy JXL module and worker lifecycle handling.
  • Enables JXL uploads, output formats, and client-generated sub-sizes, with PHP MIME and dimension handling.
  • Adds regression coverage, fixtures, and package documentation.
File Description
tools/​eslint/​config.mjs Excludes the standalone fixture generator.
test/​unit/​vitest.config.mjs Registers worker and JXL module stubs.
test/​unit/​config/​worker-code-stub.vitest.ts Stubs generated worker source.
test/​unit/​config/​vips-jxl-wasm-stub.vitest.ts Stubs JXL decoder bytes.
test/​e2e/​specs/​editor/​various/​client-side-media-processing.spec.js Tests JXL uploads, fidelity, restrictions, and batches.
test/​e2e/​assets/​.gen-jxl-fidelity-fixtures.mjs Generates JXL fidelity fixtures.
phpunit/​media/​gutenberg-get-jxl-info-test.php Tests JXL dimensions and attachment metadata.
phpunit/​media/​gutenberg-filter-jxl-filetype-and-ext-test.php Tests JXL validation and upload restrictions.
phpunit/​media/​class-gutenberg-rest-attachments-controller-test.php Tests JXL sub-size sideloading.
packages/​vips/​src/​worker.ts Exposes JXL byte delivery through RPC.
packages/​vips/​src/​vips-worker.ts Loads and delivers decoder bytes on demand.
packages/​vips/​src/​utils.ts Enables JXL quality options.
packages/​vips/​src/​test/​jxl.ts Tests JXL initialization and instance lifetimes.
packages/​vips/​src/​test/​ensure-jxl-support.ts Tests decoder caching, delivery, and retries.
packages/​vips/​src/​jxl-wasm.ts Defines the standalone decoder module.
packages/​vips/​src/​index.ts Adds JXL processing and leased vips instances.
packages/​vips/​README.md Documents JXL byte-setting APIs.
packages/​vips/​package.json Exports the JXL script module.
packages/​vips/​CHANGELOG.md Records on-demand JXL support.
packages/​upload-media/​src/​store/​utils/​test/​vips-worker-recycle.ts Tests recycling protection during active calls.
packages/​upload-media/​src/​store/​utils/​test/​jxl-support.ts Tests conditional JXL loading in wrappers.
packages/​upload-media/​src/​store/​utils/​index.ts Loads JXL support and protects worker calls.
packages/​upload-media/​src/​store/​types.ts Adds JXL format and attachment dimensions.
packages/​upload-media/​src/​store/​test/​private-actions.ts Tests JXL thumbnails and threshold scaling.
packages/​upload-media/​src/​store/​test/​actions.ts Tests typed and untyped JXL uploads.
packages/​upload-media/​src/​store/​private-actions.ts Routes JXL uploads, formats, and dimension lookup.
packages/​upload-media/​src/​store/​constants.ts Marks JXL as client-processable.
packages/​upload-media/​CHANGELOG.md Records JXL upload support.
packages/​e2e-tests/​plugins/​disallow-jxl-uploads.php Provides an upload-restriction test plugin.
lib/​media/​load.php Registers JXL and parses its dimensions.
lib/​media/​class-gutenberg-rest-attachments-controller.php Reads dimensions for sideloaded JXL sub-sizes.
backport-changelog/​7.3/​12006.md Links the WordPress Core backport.

Review effort: Balanced

Comment thread lib/media/load.php Resolved
Comment thread lib/media/load.php Resolved
adamsilverstein and others added 8 commits November 6, 2026 22:35
A truncated codestream read missing bits as zero and reported made-up dimensions, and a `jxlp` fragment shorter than the header let the read run into the next box. Gather the header from each partial codestream box's payload, and fail when the parse needs more bits than the file holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vwYjRxyfBjAYCx2p9Kazo
unpack() can return false, so check its result before using a box size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018vwYjRxyfBjAYCx2p9Kazo
A trunk merge left the entry under the published 5.1.0 heading, which fails the changelog structure check.

Claude-Session: https://claude.ai/code/session_018vwYjVtX8TWPbn9AaYEem7
A site that maps image/jxl to image/jpeg through image_editor_output_format got JPEG sub-sizes for every JXL, flattening any transparency. Apply the alpha check PNG already gets, and load JXL support for it so vips can decode the image.

Claude-Session: https://claude.ai/code/session_018vwYjVtX8TWPbn9AaYEem7
Its only caller was runVipsCall, so the separate exported helper added nothing.

Claude-Session: https://claude.ai/code/session_018vwYjVtX8TWPbn9AaYEem7
Replace the unit tests that mocked the upload pipeline with e2e tests of the same behaviour: an untyped .jxl, an oversized JXL scaled with createImageBitmap unavailable, and output format mapping to and from JXL. Merge the remaining vips instance and worker hand-off tests, which e2e cannot reach.

The test browser now renders JXL, so the tests wait for the preview like every other format. One JXL fixture is enough to show the upload is stored byte for byte, so drop the HDR and gain map fixtures and their generator.

Claude-Session: https://claude.ai/code/session_018vwYjVtX8TWPbn9AaYEem7

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Client Side Media Media processing in the browser with WASM [Package] E2E Tests /packages/e2e-tests [Type] Feature New feature to highlight in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add JPEG XL (JXL) support

5 participants