Impressive JPEG-XL

I'm pretty amazed at the JPEG-XL image format, even moreso than I was at AVIF. I'm seriously considering converting my 1 terabyte folder of images to JPEG-XL (JXL). Unfortunately, there is little JXL image support in web browsers at this point. Let's show some tests.

This is an image generated with Stable Diffusion with the prompt "a beautiful roman woman, modern times, piazza, stylish, walking by, photograph, model shoot, movie scene, in focus". It generates it in PNG format by default. It is 5.7 MB in size.

a beautiful roman woman, modern times, piazza, stylish, walking by, photograph, model shoot, movie scene, in focus
Stable Diffusion PNG image

Here is a 100% zoom comparison of the same image after conversion to JXL format. The JXL file is 863 KB in size. The JXL conversion is on the left, the original PNG is on the right. 

side-by-side comparison of png and jxl
JXL on the left, PNG on the right

Using GIMP, let's zoom in to 400% to compare the JXL (863 KB) with the PNG (5.7 MB). First the PNG then the JXL underneath. I purposely picked the detail of the eye, top of the ear, and the hair to show the fidelity.

400% zoom original PNG
400% zoom original PNG
400% zoom of JXL conversion
400% zoom JXL conversion

Now let's test it on some real world images. SailGP was in town and I shot roughly 968 images. Overall, the original JPG images are 12 GB in total. A conversion to 98% quality JXL results in a total of 6.9 GB of images. 

Here is the original, raw off the camera JPG at 12.3 MB large. This is not the best photo composition: it's too dark, the polarized filter isn't optimal, and it was cloudy and drizzling. Also, the boats move quick, so it's not the best focus. However, we're not here to critique my photo, but rather the amazing fidelity of the JXL conversion. 

SailGP Canada rounding the mark
Original off the camera JPG

Here is a screenshot of the same image converted to 98% quality JXL (5.9MB).

JXL of same image of SailGP Canada rounding the mark
JXL of SailGP Canada rounding the mark

And now, let's zoom in. 100% zoom of the JXL. You can view the original JPG to compare the original to the JXL conversion. 

100% zoom of JXL conversion
100% Zoom of JXL conversion
100% of original JPG
100% zoom of original JPG

As you can see, even at 200% file size reduction, the quality is identical.

Let's compare 400% zoom. We're running into the limits of the camera sensor and lens here, but the point is the quality of the JPG -> JXL conversion doesn't lose any quality of the image, even at over half the file size saved.

original JPG 400% zoom
400% Zoom of original JPG
400% zoom of JXL conversion
400% Zoom of converted JXL

99% of my original photos are not going to be blown up past 75% zoom, nevermind 100% or 400%. Most of my photos are displayed on a large monitor as a screensaver or as part of selected images as a background art display. JXL is perfect for this usage.

Bulk Conversion

From a technical perspective, I used a quick command line to do the conversions from PNG/JPG to JXL format at 98% quality:

find ./ -type f -print0 | xargs -0 -I{} -P(nproc) magick -quality 98 {} ../sailgp-jxl/{}.jxl

At 98% quality, I would cut the total size of my photo library by around 56%. In the real world, I would rename the files so that original_file.JPG is original_file.JXL. The quick hack above renames original_file.JPG to original_file.JPG.jxl, which is less than optimal. 

Conversion Quality Test

Now, let's test how the different quality settings affect the visual quality of the same image. If you do not specify a quality setting, magick uses 90%. Here's the output of file sizes by various quality as the first 2 numbers in the filename.

file size by quality
file size by quality

For reference, at 25% quality, the file size is 65k. At 50% quality, the file size is 82k. And so on. As a point of reference, the 90% conversion is the same as the default when you do not specify the quality parameter to magick. See original.jxl vs 90_original.jxl. How do they look?

original PNG
Original PNG
90% Quality of original conversion
90% Quality Conversion to JXL
75% quality JXL
75% Quality Conversion to JXL
50% Original JXL
50% Quality Conversion to JXL
25% Quality to JXL
25% Quality Conversion to JXL

On a phone, they all look pretty good and you wouldn't notice much of a difference. On a big monitor, the differences become noticeable at 50% quality of original, without zooming in.

For comparison, here's 10% quality from original at 46KB file size. Still looks decent on the phone, however really bad on any larger size screen.

10% quality conversion to JXL
10% Quality Conversion to JXL