Investigate saving images to JPEG XL format

This format a) is more space efficient than JPEG at equivalent quality levels, and generally more efficient than PNG when lossless b) will be able to support >8 bits per channel, which would be useful once compositors support HDR and people want better but still lossy screenshots of media.

I slightly prefer this format over the other JPEG replacement candidates (WEBP and AVIF), since those have 10bpp and 12bpp limits; acceptable to be displayed again, but not as good if one wants to, say, do post processing on a (linear color space, 16f pixel) screenshot from a video game. AVIF also has seams at 8k tiles.

I have a prototype branch adding JXL support called jxl under https://git.sr.ht/~mstoeckl/grim/ . However, I do not think it is will be worth merging in the near future, because:

  • Saving JXL images is noticeably slow, at the moment
  • It is not clear what the best command line interface is; should grim save lossless or lossy by default? (The format also has two main encoding modes, Modular and VarDCT, which approximately handle UIs and photos well, respectively. Screenshots may include either category.)
  • Not many image viewers have support for the format yet, nor do any web browsers in standard configuration
  • Some of the API used in the branch will be deprecated by the next libjxl release
Assigned to
10 months ago
7 months ago