Skip to content

460380 Support HDR in the JPEG XL plugin

Amy spark requested to merge lsegovia/krita:work/amyspark/jxl into master

This MR adds support for HDR in the JPEG XL plugin. Like AVIF, JPEG XL has two ways of embedding a colour profile:

  • CICP values
  • ICC profile blob

of which only the former is recognised by Chrome as HDR directly. And even then, only PQ, HLG and linear are recognised as valid transfer curves 1.

Additionally, I found three bugs in Krita:

  • (from)NormalisedChannelValues is arbitrarily clamping the range to SDR, which means all exported images (in particular HLG) are in fact being imported/exported as SDR (fixed here)
  • the Little CMS machinery doesn't recognise linear gamma profiles, assigning TRC_UNDEFINED to them (not fixed yet)
  • the transfer curves are mistakenly applied across all the channels, including (erroneously) alpha

BUG: 460380

Bugs found so far

Test Plan

Build Krita. Open JPEG XL images such as the ones in https://people.csail.mit.edu/ericchan/hdr/hdr-jxl.php and export them using the different options.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Amy spark

Merge request reports