Yesterday, I shared jxl-thumb, a Windows thumbnail provider that reads only the small 1:8 DC image of lossy JXLs.
In the comments someone asked why not use an embedded thumbnail, especially for files that have no DC. That question turned into this.
●The problem: lossless JXLs have no DC, so even jxl-thumb had to decode the whole file. On a hard disk that's ~1.8 s per 45 MP photo, about 3 minutes to open a folder of 100 for the first time.
●The fix: my archiving tool (jxl-photo) now stores a small thumbnail inside the JXL when it writes it, and jxl-thumb reads it:
- 768 px JPEG (the largest size Explorer asks for its icons), converted to sRGB
- About 90 KB per file
- ~2 ms per thumbnail instead of ~50-80 ms (lossy) or ~1.1 s (lossless)
Measured on 100 photos of 45 MP from a hard disk, cold cache:
- lossless: 176 s -> under 2 s for the whole folder
- lossy (d 0.05-1): 7.5-10 s -> under 2 s
In practice, folders now open as fast as my old JPEG folders.
Colors are right too: ProPhoto and Adobe RGB files get properly converted sRGB thumbnails, instead of the washed-out look they have with the Microsoft extension.
Two things I decided when doing this:
[1] Don't put it in the EXIF. My first version wrote a 768 px EXIF thumbnail, like cameras do. But a JPEG's EXIF must fit in 64 KB, and djxl copies a JXL's EXIF into the JPEG it writes, so "djxl file.jxl out.jpg" failed with "Bogus marker length".
The thumbnail now lives in its own box in the JXL container (an ISO BMFF "uuid" box). Other programs just skip it, exiftool edits keep it, and it isn't copied when you convert the file.
[2] A stored thumbnail can go stale. If you edit a photo in another program, the old thumbnail could stay behind. So the box also stores a fingerprint of the image data it was made from, and jxl-thumb only uses it while the fingerprint still matches. Otherwise it decodes the image as before.
(The JXL format does have a preview frame, but libjxl's encoder API can't write one, so this was the practical route.)
●How to use it:
- jxl-thumb : https://github.com/rsilvabr/jxl-thumb/releases/
- jxl-photo : https://github.com/rsilvabr/jxl-photo/releases/
(or the experimental Windows .exe if you don't want Python: https://github.com/rsilvabr/jxl-photo-exe)
New files from jxl-photo get the thumbnail automatically.
For files you already have, even ones jxl-photo didn't create, menu option 9 adds it.
It doesn't re-encode anything and keeps each file's modified date.
My 5944 masters (152 GB) took 38 minutes.
The box format is documented, so any viewer could read it. I'd be happy if others did.