Skip to content

Fix LCMS ICC color primaries and white point detection

Rasyuqa A H requested to merge rasyuqaa/krita:rasyuqaa/cms into master

This MR is an attempt to fix color primaries and white point detection from ICC profile.

On some ICC v2 profiles, I noticed that some didn't return a correct primaries when profile()->getColorPrimaries() is called. Instead, it returns non-chromatically adapted primaries which then returns as PRIMARIES_UNSPECIFIED even on an supported primaries. This effect also can be shown on color space browser:

primariesdetection

While I'm at it, I also noticed incorrect white point on a slightly cursed ICC v4 profiles which have chromatic adaptation tag chad field set, but the media white point wtpt is not set at D50 / already chromatically adapted. This results in the white point get transformed further. Here it can be shown on color space browser too:

wtptcorrection

Test Plan

Browse ICC profiles and/or call profile()->getColorPrimaries() / profile()->getColorantsxyY() / getWhitePointxyY(), check if the primaries and white point are matched to the reference standard.

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 Rasyuqa A H

Merge request reports

Loading