Implement saving CICP to PNG.

Part of #86, companion to !2776 (merged)

This patch allows reading and writing the cICP chunk, as per PNG3, it replaces saving the special string/profile, though we still load it.

It does a bunch of other stuff too, like making it explicit whether people want to save the color info (proven to be necessary over the years), and whether people also want to save the extra chroma and gamma chunks.

Sample HDR image with CICP set to rec 2100 pq:

hdr_gem_2_cicp

To Do

  • Save chroma and gamma chunks
  • Implement tests (wpt has some sample files).
  • Implement saving HLG and SMPTE428 + tests
  • Implement loading HLG and SMPTE428 + tests
  • write/read HDR metadata + tests.
  • ensure that the sRGB toggle is disabled when appropriate.
  • ensure it is possible to write 8bit HDR images when the downsample toggle is active.

Test Plan

  • Create a floating point image.
  • Save it as rec2100 pq or rec2100 HLG
  • Load resulting file in chromium (in firefox it will look too dark). This should look vaguely color managed.
  • Load result in Okular, this should look faded and uncolormanaged.
  • Open the colorful kiki in this blogpost. It should load as rec 2020 709 trc.

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.
  • Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?
Edited by Wolthera van Hövell

Merge request reports

Loading
Loading