JPEG XL
The next-generation “Alien Technology from the Future”
Last update: October 2024
The original version of this presentation was presented at ImageReady in October 2020
Slides by
Jon Sneyers
&
Prelude
Why image compression?
Digital images
3
4
An image is worth a million words
5
An image is worth a million words
6
=
Lossless and lossy compression
7
Web page weight
8
It’s not just web pages
9
TL;DR: Compression (still) matters!
10
JPEG
11
“JPEG is
Alien Technology
from the Future”
�– Tim Terriberry
12
Why do we need something new?
13
14
“JPEG XL is
Next-generation�Alien Technology
from the Future”
– Somebody from the future (I hope)
15
JPEG XL features
What can the JPEG XL codec do?
What we preserved from JPEG
17
What we preserved from JPEG
18
What we added
19
JPEG
20
JPEG XL
21
More powerful, more complicated, but not slower
22
Key features
23
Key features
(unique feature)��Lossless JPEG recompression
24
Key features
25
26
Progressive decode
27
Key features
28
Generation loss resilience
29
Fully automatic encoding
30
human has to sit here to control the encoder
Fully automatic encoding
31
no human needed to control the encoder
Encoder consistency
32
less consistent
more difference in quality for the same settings
more consistent
less difference in quality for the same settings
Subjective test results
Overall: ~10% better (smaller for same visual quality) than AVIF when comparing at same encode effort, ~20% if aligning by p5 quality rather than p50
33
Overall results hide some variation
Overall: ~10% better (smaller for same visual quality) than AVIF, ~20% better than WebP, ~30% better than JPEG
Diagrams (lossy non-photo):�~30% worse than AVIF�~10% worse than WebP�~40% better than JPEG
Landscape / nature:�~30% better than AVIF�~30% better than WebP�~30% better than JPEG
Portraits:�~20% better than AVIF�~25% better than WebP�~30% better than JPEG
34
35
← better compression
36
← better compression
37
JPEG XL (libjxl e6)
baseline: unoptimized JPEG (libjpeg-turbo, 4:4:4)
optimized JPEG (mozjpeg, 4:2:0)
AVIF (libaom s6, 4:4:4)
AVIF (libaom s7, 4:4:4)
AVIF (libaom s8, 4:4:4)
WebP (libwebp m4, 4:2:0)
AVIF (libaom s6, 4:4:4)
AVIF (libaom s7, 4:4:4)
AVIF (libaom s8, 4:4:4)
JPEG XL (libjxl e6)
WebP (libwebp m4, 4:2:0)
optimized JPEG (mozjpeg, 4:2:0)
very low quality
q20
visually lossless
q95
high quality
q75
low quality
q30
medium quality
q50
Trade-offs between speed and compression
38
Codec | Enc Speed�(Mpx/s, single core) | MT�(can use multi-threading effectively?) | Saving�compared to unoptimized JPEG�at medium-high quality | Saving�compared to unoptimized JPEG�at visually lossless quality |
JPEG (libjpeg-turbo) | 100 | no | 0 | 0 |
JPEG (mozjpeg) | 5 | no | 15% | 0% |
WebP | 6 | no | 20% | N/A |
HEIC (x265) | 2 | yes, but | 30% | 25% |
AVIF s9 | 5 | yes, but | 15% | 10% |
AVIF s8 | 2 | yes, but | 25% | 20% |
AVIF s6 | 1 | yes, but | 35% | 25% |
AVIF s0 | 0.01 | yes, but | 40% | 35% |
JPEG XL e3 | 10 | yes | 30% | 40% |
JPEG XL e6 | 5 | yes | 40% | 45% |
(ballpark numbers for a typical CPU and photographic image, actual numbers depend on the specific hardware and image)
JPEG XL features
39
Objective results: HDR
40
Objective results: HDR
41
Lossless: best compression
42
Summary | Size difference vs. JPEG XL (-e 9 -E 3 -I 1) | ||||||||||
Type | Image category | WebP | WebP v2 | FLIF | AVIF | PNG | Effort 9 | Effort 7 | Effort 3 | BMF (-s) | EMMA |
Digital 2d Art | 16.8% | 10.2% | 5.8% | 71.3% | 47.7% | 3.3% | 8.3% | 29.5% | -3.8% | -11.6% | |
Digital 2d Art | 19.2% | 10.2% | 8.7% | 51.1% | 52.9% | 2.4% | 9.7% | 38.3% | -5.0% | -13.3% | |
Comics / B&W | 21.1% | 15.9% | 6.0% | 140.3% | 53.9% | 2.5% | 10.5% | 32.6% | -2.1% | -11.0% | |
Pixel Art | 12.7% | 14.2% | 32.4% | 106.4% | 46.1% | 5.0% | 18.8% | 274.9% | -10.0% | -0.5% | |
Emoji / Icons | 11.4% | 6.0% | 12.0% | 56.0% | 50.0% | 3.2% | 9.6% | 25.6% | -7.1% | -4.7% | |
Digital 2d Art | 15.4% | 10.2% | 9.7% | 38.0% | 50.7% | 2.6% | 6.6% | 21.7% | -7.8% | -11.1% | |
Comics | 20.4% | 12.6% | 6.0% | 95.7% | 58.3% | 4.4% | 12.2% | 41.4% | -1.4% | -12.7% | |
Game Assets | 10.6% | 6.8% | 9.2% | 79.2% | 45.2% | 6.6% | 19.7% | 70.2% | -10.9% | -15.8% | |
Game Screenshots | 13.1% | 7.1% | 5.8% | 40.2% | 41.3% | 3.3% | 7.0% | 28.5% | -6.2% | -13.9% | |
Photo | 10.5% | 5.2% | 2.2% | 47.6% | 40.6% | 2.8% | 5.2% | 19.6% | -6.6% | -10.9% | |
Photo | 11.9% | 8.0% | 4.0% | 23.2% | 41.1% | 0.9% | 2.6% | 7.2% | -5.4% | -6.3% | |
Photo | 13.8% | 11.0% | 5.3% | 33.8% | 33.4% | 1.2% | 2.2% | 12.9% | -5.0% | -8.1% | |
Digital 3d Art | 16.1% | 5.3% | 3.9% | 46.7% | 43.8% | 2.0% | 10.1% | 36.5% | -8.5% | -15.6% | |
Fractal Art | 10.9% | 7.6% | 3.7% | 47.6% | 38.8% | 5.6% | 10.9% | 36.6% | -0.2% | -11.3% | |
Average % larger than jxl | 14.6% | 9.3% | 8.2% | 62.7% | 46.0% | 3.3% | 9.5% | 48.3% | -5.7% | -10.5% |
43
Lossless image compression
43
smaller files
faster to encode
libjxl�max effort
libjxl�min effort
JPEG XL is
Pareto best
PNG
44
45
JPEG XL development
Who created JPEG XL and how?
47
A collaborative effort
Jyrki Alakuijala, Sami Boukortt, Martin Bruse, Iulia-Maria Comsa, �Alex Deymo, Moritz Firsching, Thomas Fischbacher, Sebastian Gomez, Renata Khasanova, Evgenii Kliuchnikov, Jeffrey Lim, Robert Obryk, Krzysztof Potempa, Alexander Rhatushnyak, Zoltan Szabadka, Lode Vandevenne, Luca Versari, Jan Wassenberg
Cloudinary
Jon Sneyers�(Eric Portis, Tal Lev-Ami, Colin Bendell, ...)
Other JPEG experts
Touradj Ebrahimi, Walt Husak, Andy Kuzma, Fernando Pereira, Antonio Pinheiro, Thomas Richter, Peter Schelkens, Osamu Watanabe, …
48
A brief history of JPEG XL: my background story
49
A brief history of JPEG XL: the Google compression team
50
It took almost two years to combine Pik and FUIF
51
History
52
History (2)
53
History (3)
54
First editions published
55
Current status
56
libjxl — reference implementation of JPEG XL
https://github.com/libjxl/libjxl
BSD-3 license (permissive FOSS)
Development opened to external contributions in May 2021
Production-ready reference implementation
Royalty-free, free & open source, efficient and robust
57
libjxl releases
☑ Version 0.1: Format release candidate (Nov 14th, 2020)
☑ Version 0.2: Format release (December 24th, 2020)
No more backwards-incompatible changes after this�(bitstreams created with encoder 0.2 remain decodable by future decoders)
☑ Version 0.3: Stable libjxl decode API (January 29th, 2021)
☐ Version 0.4: Full decoder implemented (“the missing release”)
No more forwards-incompatible changes after this�(decoder version 0.4 can decode bitstreams from future encoders)
☑ Version 0.5: Encoder improvements (August 2nd, 2021)
☑ Version 0.6: API improvements (October 4th, 2021)
☑ Version 0.7: Semi-final API (September 21st, 2022)
☑ Version 0.8: fast lossless, API tweaks (January 18th, 2023)
☑ Version 0.9: color management in decoder (December 22nd, 2023)
☑ Version 0.10: streaming encoding, significant speedups (February 21st, 2024)
☑ Version 0.11: no more aborts, gain map API (September 13th, 2024)
☐ Version 1.0: Fully finalized encode+decode API (Q3 2024?)
58
fjxl — fast lossless jxl encoder (now libjxl e1)
59
Independent implementations
Conformance testing: https://libjxl.github.io/bench/
60
Industry support is growing
61
Adoption
Browsers:
Image libraries: ImageMagick, libvips, Imlib2, ffmpeg
OS-level / toolkits: All Apple OSes (iOS, macOS, …), GDK-pixbuf, Qt, gThumb
Image authoring: GIMP, Krita, darktable, Adobe Camera Raw, Affinity Photo
Image viewers: XnView, ImageGlass, gwenview, digiKam, KolourPaint, KPhotoAlbum, LXImage-Qt, qimgv, qView, nomacs, VookiImageViewer, PhotoQt, ...
62
“There is not enough interest from the entire ecosystem to continue experimenting with JPEG XL.”
We want JPEG XL support in all browsers!
We already support JPEG XL!
We will ship JPEG XL support if there is a Rust implementation.
etc etc
Let’s dive deeper
Details for the image compression geeks
JPEG XL
coding tools
JPEG XL
coding tools
+ the giant ones (up to 256x256), not currently used in the encoder
JPEG
WebP
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
Progressive decode
70
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL: Modular mode
80
JPEG XL
coding tools
JPEG XL
coding tools
Visualization of predictor choice
Prediction, Entropy coding and Context modeling
83
Comparison
84
Codec | Prediction | Entropy coding | Context modeling |
TIFF | None | RLE | / |
JPEG | Left (DC) or none (AC) | Huffman | / |
PNG | can choose per row | Huffman + lz77 | / |
WebP | can choose per block | Huffman + 2D-lz77 | per block and per channel |
FFV1 | fixed (gradient) | AC | fixed (quantized local differences) |
FLIF | can choose per channel | AC | MA trees |
JPEG XL | can choose per context�(predictor + offset + multiplier) | ANS (or Huffman) + 2D-lz77 | MA trees specify context and predictor; more MA properties |
Predictors
85
Predictor | PNG | Lossless WebP | FFV1 | FLIF | JPEG XL |
Zero (none) | | | | | |
Left (W), Top (N) | | | | | |
LeftLeft (WW) | | | | | |
Avg(Left, Top) | | | | | |
Paeth | | | | | |
Select | | | | | |
Gradient | | | | (non-interlaced) | |
TopLeft (NW), TopRight (NE) | | | | | |
Avg(Left, TopLeft) | | | | | |
Avg(Top, TopLeft) | | | | | |
Avg(Top, TopRight) | | | | | |
Avg(Left, TopLeft, Top, TopRight) | | | | | |
Avg(Top, Avg(Left, TopRight)) | | | | | |
Weighted sum of W, WW, N, NN, NE, NEE | | | | | |
Predictors involving Bottom | | | | (interlaced) | |
Self-correcting (Weighted) Predictor | | | | | |
86
AvgAll
West
North
NorthWest
NorthEast
Gradient
AvgN+NW
AvgW+NW
?
?
?
?
?
?
?
?
87
AvgAll
West
North
NorthWest
NorthEast
Gradient
AvgN+NW
AvgW+NW
Context properties
88
Property | FFV1 | FLIF | JPEG XL |
Previous channel(s) pixel value(s) | | | |
Previous channel(s) error | | | |
Absolute value of the above | | | |
Gradient | | | |
Left-TopLeft (W-NW) | (quantized) | | |
TopLeft-Top (NW-N) | (quantized) | | |
Top-TopRight (N-NE) | (quantized) | | |
TopTop-Top (NN-N) | (quantized, ‘large’ model) | | |
LeftLeft-Left (WW-W) | (quantized, ‘large’ model) | | |
Properties involving Bottom | | (interlaced mode) | |
Left Gradient error | | | |
Group index | | | |
x and y position | | | |
abs(N), abs(W) | | | |
Weighted Predictor max-amplitude-error | | | |
Minimum bits per symbol (best-case)
89
Header overhead: how many bytes is a 1-pixel image?
90
| white #FFFFFF | black�#000000 | gray�#7F7F7F | yellow #FFFF00 | transparent�#00000000 | semitransparent #1337BABE | Smallest valid file (any size) |
PNG | 67 | 67 | 67 | 69 | 68 | 70 | 67 |
GIF | 35 | 35 | 43 | 35 | 37 | / | 35 |
JPEG | 160 | 160 | 159 | 288 | / | / | 107 |
WebP | 38 | 34 | 38 | 36 | 34 | 38 | 26 |
FLIF | 15 | 14 | 15 | 18 | 14 | 20 | 14 |
JPEG XL | 19 | 13 | 20 | 20 | 17 | 25 | 12 |
AVIF | 314 | 307 | 304 | 314 | 500 | 507 | 298 |
HEIC | 540 | 540 | 575 | 582 | 871 | 950 | 386 |
Interlude: JPEG XL Art
What is it and how does it work?
JPEG XL
AVIF
117 byte jxl file:
117 byte avif file:��“Hi there! I am an AVIF image, with the brands avif, mif1, miaf, MA1A, encoded with libavif, and you should handle me as a picture, and my dimensions are —”
92
JPEG XL Art
93
JPEG XL
117 byte jxl file:
94
Width 1000
Height 1000
RCT 1
if y > 400
if x > 500
if WGH > 0
- AvgN+NW + 2
- AvgN+NW - 2
if WGH > 0
- AvgN+NE + 2
- AvgN+NE - 2
if c > 1
if y > 0
if N > -10
- N - 1
- N + 0
- Set 300
if c > 0
if y > 0
- N + 1
- Set -510
if y > 0
if y > 220
if x > 499
if x > 500
- NW + 0
if y > 280
if N > -100
- N - 10
- Set 0
if N > 300
- Set 200
- N + 10
- NE + 0
if x > 500
- NE + 0
- NW + 0
if W > -100
if W > 300
- Set 200
if x > 960
- W + 10
if x > 800
- W - 10
if x > 628
- W + 10
if x > 340
- W - 10
if x > 175
- W + 10
if x > 0
- W - 10
- Set 255
- Set 0
Online JXL Art tool
95
(end of interlude
on JPEG XL Art)
JPEG XL
coding tools
image by Masakazu Matsumoto
JPEG XL
coding tools
JPEG XL
coding tools
JPEG XL
coding tools
Thank You.
Further reading:
JPEG XL and the Pareto Front (Feb 28, 2024)�JPEG XL: How It Started, How It’s Going (Jul 12, 2023)�Contemplating Codec Comparisons (Dec 14, 2022)�The Case for JPEG XL (Nov 2, 2022)�Time for Next-Gen Codecs to Dethrone JPEG (Feb 22, 2021)�What to Focus on in Image Compression: Fidelity Or Appeal (Dec 30, 2020)�How JPEG XL Compares to Other Image Codecs (May 26, 2020)
�(list of all Cloudinary blog posts by me)