JPEG XL Offers Up to 22% Storage Savings Through Lossless JPEG Transcoding
Share this article
Digital archivists, photographers, and data hoarders routinely battle storage constraints. JPEG XL—a modern image format developed by the Joint Photographic Experts Group—offers a compelling solution: lossless JPEG transcoding that shrinks file sizes by an average of 22% without altering original pixel data. Unlike traditional lossy conversions (e.g., JPEG to AVIF), this technique repackages existing JPEG information into JPEG XL's efficient container, enabling bit-for-bit reconstruction of the source file.
The Technical Workflow
Conversion relies on the reference implementation's cjxl tool. For lossless transcoding:
cjxl -j 1 -e 10 -d 0 image.jpg image.jxl
-j 1: Enables JPEG reconstruction mode-e 10: Maximizes compression effort (trades CPU time for smaller output)-d 0: Ensures lossless handling if source isn’t JPEG
Verification uses djxl and cmp:
djxl image.jxl decoded-image.jpg
cmp image.jpg decoded-image.jpg || echo "Reconstruction failed"
Batch processing leverages find and GNU Parallel:
find /gallery \( -name \*.jpg -o -name \*.jpeg \) -print0 |
parallel --null nice python3 jpg-to-jxl.py
Limitations and Ecosystem Gaps
Despite efficiency gains, JPEG XL faces adoption barriers:
- Limited native support: Safari offers basic decoding; Chrome removed experimental support. Web deployment requires on-the-fly conversion back to JPEG for compatibility.
- Tooling inconsistencies: Applications like Geeqie may mishandle embedded color profiles. Malformed JPEGs might require --allow_jpeg_reconstruction 0, sacrificing bit-for-bit fidelity.
- Opaque compression metadata: JPEG XL doesn’t flag whether content originated from lossy/lossless sources—a concern for preservationists.
Lossless Compression Benchmarks
For non-JPEG originals, JPEG XL’s lossless mode competes with WebP and PNG:
| Format | Total Size | Savings vs PNG |
|---|---|---|
| PNG | 9.60 GB | — |
| WebP | 7.63 GB | ~20% |
| JPEG XL | 6.39 GB | ~33% |
Results from 1,346-image test corpus.
Strategic Implementation
Author Michał Nazarewicz recommends a hybrid approach: Transcode JPEGs to JPEG XL for storage savings, but convert lossless originals (like PNG) to WebP—which preserves compression-type metadata. While JPEG XL’s space efficiency is transformative for storage-heavy use cases, its ecosystem maturity lags behind its technical promise. Widespread adoption hinges on broader toolchain integration and browser support.
Source: mina86.com