Skip to content

Add JPEG XL (JXL) encoder - #115

Merged
olivervogel merged 1 commit into
Intervention:developfrom
nlemoine:feature/jxl-encoder
Jul 11, 2026
Merged

Add JPEG XL (JXL) encoder#115
olivervogel merged 1 commit into
Intervention:developfrom
nlemoine:feature/jxl-encoder

Conversation

@nlemoine

Copy link
Copy Markdown
Contributor

This adds JPEG XL as an encodable format in the vips driver.

It follows the AvifEncoder and HeicEncoder. Encoding goes through libvips' jxlsave via writeToBuffer('.jxl', ...). libvips' jxlsave has a native lossless flag, but JXL has no separate lossless setting beyond maximum quality, so I enable it at Q 100, same as the AVIF and HEIC encoders here.

LoaderDetector now maps the jxl loader to Format::JXL. Without that, supports(Format::JXL) returns false even when libvips has the loader.

For CI and Docker I added libjxl-dev to the apt list. Both build libvips from source, and libvips enables JXL when libjxl is present at build time. Both bases (Debian for the Dockerfile, ubuntu-24.04 for CI) have libjxl-dev in apt.

This needs the JXL support from core, so it requires intervention/image ^4.2 (JXL shipped in 4.2.0).

I ran the suite in Docker against libvips 8.18.1 built with libjxl, all green. The JxlEncoder test does a real jxlsave, and the driver reports supports(Format::JXL).

Encodes JXL through libvips' jxlsave, mirroring the AVIF and HEIC encoders.
libvips has a native lossless flag, but JXL has no separate lossless setting
beyond maximum quality, so it is enabled at Q 100 like the sibling encoders.

LoaderDetector now maps the jxl loader to Format::JXL so the driver reports
JXL support when libvips is built with libjxl. The Dockerfile and CI workflow
install libjxl-dev so the source-built libvips includes the JXL loader and
saver.

JXL support requires intervention/image 4.2.0, so the constraint is bumped
to ^4.2.
@olivervogel

Copy link
Copy Markdown
Member

Great. Thanks.

@olivervogel
olivervogel merged commit 93ac164 into Intervention:develop Jul 11, 2026
6 checks passed
@olivervogel

Copy link
Copy Markdown
Member

Released in 4.1.0.

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 this pull request may close these issues.

2 participants