JPEG XL on Linux: Converting, Viewing, and When It Is Worth Using
With Firefox 158 displaying JPEG XL images, the format has another major supporter. It has been usable on Linux for a while in image editors and viewers. Here is what it offers and how to use it.
Why JPEG XL
JPEG XL (.jxl), standardised as ISO/IEC 18181, is designed as a successor to JPEG with:
- Better compression: similar quality at substantially smaller files than JPEG
- Lossless JPEG recompression: shrink existing JPEGs by around 20 percent, reversibly, with no change in quality
- Lossless mode for graphics and archives, competitive with PNG and WebP lossless
- HDR and wide colour gamut, high bit depths, transparency, and animation
- Progressive decoding, so a low-quality preview appears quickly on slow connections
The lossless JPEG trick is the most practical feature for existing photo collections: the file gets smaller, and you can recover the exact original JPEG, byte for byte.
Install the tools
The reference library, libjxl, provides cjxl (encoder) and djxl (decoder):
sudo apt install libjxl-tools # Debian / Ubuntu
sudo dnf install libjxl-utils # Fedora
sudo pacman -S libjxl # Arch
Convert
Existing JPEG, losslessly:
cjxl photo.jpg photo.jxl
ls -l photo.jpg photo.jxl
djxl photo.jxl restored.jpg
cmp photo.jpg restored.jpg && echo identical
For JPEG input, lossless transcoding is the default.
PNG or other images, lossy:
cjxl -d 1.0 screenshot.png screenshot.jxl
-d is distance: 0 is mathematically lossless, 1.0 is visually lossless for most people, and higher numbers mean smaller files with more loss. You can use -q 90 instead if you prefer a JPEG-style quality scale.
Lossless PNG replacement:
cjxl -d 0 -e 7 diagram.png diagram.jxl
-e sets effort from 1 to 10: higher is slower and smaller.
Batch-convert a folder of JPEGs:
for f in *.jpg; do cjxl "$f" "${f%.jpg}.jxl"; done
Use GNU parallel or xargs -P to use every core on large folders.
View and edit
| App | Support |
|---|---|
| GIMP, Krita | Open and export |
| darktable | Export, including HDR |
| ImageMagick | magick input.png output.jxl with libjxl support |
| GNOME Image Viewer (Loupe) | Views JPEG XL |
| gThumb | Views JPEG XL |
| KDE apps (Gwenview, Dolphin thumbnails) | Through the kimageformats plugin |
| Firefox | Displays from version 158 |
| FFmpeg | Reads and writes with libjxl support |
If thumbnails do not appear in your file manager, install the JPEG XL pixbuf loader or kimageformats package for your distribution.
Where it makes sense
Good uses today:
- Archiving photos: lossless JPEG transcoding saves space with zero risk, since you can always regenerate the original
- Photography workflows, especially HDR exports from darktable
- Screenshots and graphics where you want lossless files smaller than PNG
- Your own systems, where you control every app that opens the files
Be careful with:
- Websites: browser support is not universal; serve it with a fallback using the HTML
<picture>element - Sharing: phones, messaging apps, and cloud services may not open
.jxlfiles - Replacing originals: keep originals until you are sure everything you use reads JPEG XL
Compared with other formats
| JPEG | WebP | AVIF | JPEG XL | |
|---|---|---|---|---|
| Lossy compression | Baseline | Better | Much better at low bitrates | Much better, especially at high quality |
| Lossless | No | Yes | Yes | Yes, strong |
| Recompress old JPEGs losslessly | n/a | No | No | Yes |
| HDR / high bit depth | No | No | Yes | Yes |
| Browser support | Universal | Universal | Wide | Growing |
For media conversion beyond images, our ffmpeg guide covers video and audio, and our zstd and 7-Zip guide covers general-purpose compression.
Frequently Asked Questions
What is JPEG XL?
JPEG XL is a modern image format standardised as ISO/IEC 18181. It offers better compression than JPEG at the same quality, supports lossless images, HDR, wide colour, transparency, and animation, and can losslessly recompress existing JPEG files.
How do I convert an image to JPEG XL on Linux?
Install libjxl tools, then run cjxl input.png output.jxl. For a JPEG input, cjxl transcodes losslessly by default, producing a smaller file that can be turned back into the identical original JPEG with djxl.
How much smaller are JPEG XL files?
Lossless recompression of existing JPEGs typically saves around 20 percent with no quality change. For new lossy images, JPEG XL usually matches JPEG quality at substantially smaller sizes; the exact saving depends on the image and settings.
Which Linux apps support JPEG XL?
GIMP, Krita, darktable, ImageMagick, and image viewers including GNOME’s Loupe, gThumb, and KDE apps through the kimageformats plugin. Firefox displays JPEG XL from version 158. Support in other browsers varies, so check before using it on a website.
Can I get my original JPEG back?
Yes, if the JPEG XL file was made by lossless JPEG transcoding, which is the cjxl default for JPEG input. Run djxl file.jxl original.jpg and the result is bit-for-bit identical to the original JPEG.
Should I convert my photo library to JPEG XL?
Only if every app and device you use can read it. Lossless transcoding is reversible, which makes it lower risk, but phones, cloud services, and some software may not open .jxl files. Many people keep originals and use JPEG XL for archives or exports.