About JPEG XL format and compression support

What it is

JPEG XL: still raster image or animated raster image with layers, transparency and meta data, MIME type is image/jxl
JPEG XL (file extension .jxl) is an industry standard file format, based on the proposals of Pik and FUIF (which is based on FLIF).
JPEG XL has 3 major encoding paths while preserving meta-data and color profile: Seamless transition and codec replacement for older formats: If pixel-perfect re-encoding is not the primary objective, JPEG XL can encode to much smaller files while maintaining perceived quality.

Check JXL support in your browser

Check to see if you can view a JXL image file:
(a JXL-enabled browser should show 'OK' here)

Note: For Chromium and Firefox users, a possible route is to use a WASM (WebAssembly) module like jxl_dec.wasm for decoding (see jxl.js in table below).

JXL is supported by the following applications (and many more):

softwareversiondecodeencode
imagemetadataencode
Gimp2.10+Works with preliminary plugin from JPEG-XL repository.Works with preliminary plugin from JPEG-XL repository.
With extra options for encoding (encoding speed, distance, ...)
Saving to JPEG-XL in Gimp plugin only available when reference software is compiled with option -DJPEGXL_ENABLE_GIMP_SAVING=1
djxl 0.11.1JPEG-XL Reference Software
command line tool
Usage: djxl input output

Tool is included in Debian “bookworm” package: libjxl-tools
cjxl 0.11.1JPEG-XL Reference Software
command line tool
Usage: cjxl input output
Get more options with:
# cjxl -v -v -h

Tool is included in Debian bookworm package: libjxl-tools
jxlinfo 0.11.1JPEG-XL Reference Software
example tool
Usage: jxlinfo [jxl file]
KDE/Qt
applications
yes,
with qt-jpegxl-image-plugin
yes,
with qt-jpegxl-image-plugin
exiftool12.23+yes, recognizes both:
  • codestream-only format
  • JXL container with XMP/EXIF data
ImageMagick7.0.10-54
gThumb3.11.3displayyes
https://squoosh.app
a WASM app for browsers
uses libjxl v0.3.1
in-browser WASM / JS
JPEG-XL decoding
JPEG-XL encoding
multiple options
w/ effort slider
https://github.com/niutech/jxl.js
a WASM (WebAssembly) module for browsers
uses libjxl v0.3.1
available since 2022-11-15in-browser-app WASM / JS
JPEG-XL decoding

Import JXL support in a webpage with a few JS files and a WASM file.
Works with:
  • img tag
  • picture / srcset tag
  • css background url
the WebAssembly module jxl_dec.wasm is from the Squoosh app
width and height
are retained
-
Safari
Browser
iOS / macOS 17+supported on macOS and iOS devices from version 17 onwards (2023 release)
since 2023-09-18
GNOME Web
code name:
Epiphany Browser
45supported via WebKitGTK rendering engine
DNG
file format
1.7+
since 2023/06
efficient compression
of RAW and lossy image data
yesyes
DICOM
data format
2024d
since 2024/09
efficient compression
lossy, lossless, or JPEG re-encoded
image data
yesyes
discontinued products
Mozilla Firefox
Browser
Nightly 90+ onlyIn Firefox version 90+ Nightly builds only:
  • Go to about:config
  • toggle image.jxl.enabled to switch it on
The builds have integrated a recent version of the libjxl library,
updates of libjxl will be applied to Firefox Nightly every few weeks.

Missing in Firefox decoding JXL
  • partial decoding of progressively encoded JXL images is unsupported yet
  • animations not running yet
  • alpha channel isn’t properly filtered
Patches for color profiles, progressive decoding and animated JXL decoding already on hand since August 2021 but not merged into application yet.

New on Sep 4 2024:
Firefox says it will consider a Rust implementation of JPEG-XL.
https://github.com/mozilla/standards-positions/pull/1064
Chrome
Browser

Desktop only,development halted.
91-109 onlyNote: Format integration/support halted.
JPEG-XL
  • Go to chrome://flags
  • toggle enable-jxl to switch it on

Chrome had a relatively fast JXL decoder behind a flag, but no future plans for this format at the moment.



Main Features

lossless re-encoding from JPEG-old-style and PNG.
It supports bitdepths from 1-32 bits/channel, progressive encoding/decoding, lossless encoding, transparency, speed vs. compression presets, chroma subsampling, further “extra” channels for e.g. depth information, UV or (thermal) infrared.
Available mode for putting center groups first in the stream to decode a file from the middle out.
Furthermore, there is support for HDR, layers, animation and multithreaded/SIMD-optimized decoding.
Is generally superior to: WebP, HEIC and AVIF in terms of image quality and fidelity.

Allowed entropy coders


Installation of the reference software

Along with the library, you get encoding and decoding tools for the JPEG-XL image format.

Build from source:

Go to:
https://github.com/libjxl/libjxl
or
https://gitlab.com/wg1/jpeg-xl
to check the guide there.

Download step is:
via github:
git clone --depth 1 https://github.com/libjxl/libjxl.git --recursive
via gitlab (this project is just a mirror of the one at github):
git clone https://gitlab.com/wg1/jpeg-xl.git --recursive
Then build according to the README.md
Make and install the package.

The tools for encoding/decoding are called cjxl and djxl. Example tool jxlinfo gives codestream meta information.


Browser Support

This code snippet should work if you have one of these conditions met: A working code example to display a JXL picture would be then:

<picture>
  <source srcset="solar-eclipse-2022.jxl" type="image/jxl" >
  <img    src   ="solar-eclipse-2022.jpg" type="image/jpeg" alt="Solar Eclipse 2022" style="" title="Solar Eclipse 2022"/>
</picture>


Gimp Plugin

Gimp has JPEG-XL included since 2.10.32. The mimetype is image/jxl, the file extension is .jxl

This paragraph explains installation of the JXL plugin in Gimp versions prior to 2.10.32.
Note: with package libgimp2.0-dev installed beforehand, you can also create the JPEG-XL load/save plugin for Gimp with this source package.
When configuring the libjxl git clone before build, use these additional flags to create the Gimp plugin: -DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_ENABLE_GIMP_SAVING=1


Claws-Mail Plugin

In Debian Bookworm, JXL isn’t readily available in most applications.
For instance, to make claws-mail recognize the new file format, there has to be file libpixbufloader-jxl.so in the corresponding gdk-pixbuf-2.0 plugin directory.
To make claws-mail aware of that new type, it might be necessary to add a new paragraph with additional lines in loaders.cache, like this example for arm64 machines:

"/usr/lib/aarch64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jxl.so"
"jxl" 4 "gdk-pixbuf" "JPEG XL image" "BSD-3"
"image/jxl" ""
"jxl" ""
"\377\n" "  " 100
"...\fJXL \r\n\207\n" "zzz         " 100



Installation from distribution (official package):

All distributions
Package name is libjxl.

Debian
Debian package names for JXL libraries/utilities are: jpeg-xl-doc, libjxl-dev, libjxl-tools, libjxl0.7, libjxl0.8, libjxl0.9 (see https://packages.debian.org/bookworm/libjxl0.7)

If you have an up-to-date stable release installed, there are at least two ways to install packages of the recent “bookworm” suite:

 

Encoding and Decoding on the Linux Command Line

These tools are provided by the reference software.
cjxl - Encoding input image to JPEG-XL format, is capable of losslessly re-packing JPEG-1 images, including metadata
djxl - Decoding JPEG-XL to older image formats
jxlinfo - gives meta information of a JPEG-XL file

KDE/Qt support based on libjxl

Basic JXL support is included in recent versions.
In Debian, this has been released with “bookworm” in 2023.

Qt support for older installations: manual installation of plugins

(e.g., for image viewers like Gwenview):
Go to: https://github.com/novomesk/qt-jpegxl-image-plugin to check the guide there.

Basically, these are the steps for installation:

Fetch and install the reference software, see section “Installation of the reference software” above. Update mime database file

Make sure you have the Qt5 base development files installed. Correct package name for Debian/Ubuntu is: qtbase5-dev
Then, download the plugin: git clone --depth 1 https://github.com/novomesk/qt-jpegxl-image-plugin


JPEG-XL - File header structure

JXL files can be stored with or without a container.
The container can create more complex files.
Without a container, there are only 2 signature bytes FF 0A and frame data.

with container structure (e.g., to include an Exif header):
Magic bytes
00 00 00 0C  4A 58 4C 20  0D 0A 87 0A
. . . . J X L . . . .

When a container is used for a JXL file, the box signature before the actual frame data is ‘jxlc’ (6a 78 6c 63)

Low-level frame data,
without the container
(might be at the start or inside, at a later position in file):
Magic bytes
offset |  data
+oooo | FF 0A
. .

following: frame metadata, codestream data (entropy encoded)


Sample JPEG-XL begin with container boxes
and file signature (magic bytes in orange)
offset |  data
oooo | 00 00 00 0c J X L 20
ooo8 | 0d 0a 87 0a 00 00 00 14 (length of first box)
oo1o | f t y p j x l 20
oo18 | 00 00 00 00 j x l 20

sample Exif box:
oo2o | 00 00 01 A8 E x i f

(... raw Exif data are following)

sample JXL frame data box:
.... | 00 00 25 A4 j x l c

(FF 0A and entropy encoded frame data codestream are following)


Possible JXL container boxes are
Exif, jxlc, jbrd, xml  (used for XMP), jumb (JUMPF), brob (Brotli-compressed box containing metadata like Exif, xml , ...), jxli, jxlp, ...

JXL container box format
length
(4 bytes, little-endian)
box type
(4 bytes, 4-letter name, like ‘Exif’)
raw content



Proposal: JPEG-XL as more efficiently raster image codec in next-gen PDF documents

https://www.reddit.com/r/jpegxl/comments/zwc5ro/is_it_possible_to_use_jpeg_xl_images_in_pdfs/
https://info.aiim.org/aiim-blog/why-jpeg-xl-should-be-added-to-the-pdf-standard


JPEG-XL - Active Discussion

JPEG XL news and discussion on reddit
https://www.reddit.com/r/jpegxl/

Support JPEG XL - Page 13 - Mozilla Connect
https://connect.mozilla.org/t5/ideas/support-jpeg-xl/idi-p/18433/page/13

Request for re-opening the Request for position on JPEG XL · Issue #721 · mozilla/standards-positions · GitHub
https://github.com/mozilla/standards-positions/issues/721 Closed


JPEG XL (official community website)
https://jpegxl.info/


 

JPEG-XL - in Music

Give JXL a Chance
is a song that uses a popular melody to embrace the modern JPEG-XL image format, which is supported by a growing number of image viewing/editing applications - and maybe reach general browser support in 2024, we’ll see.