Coding KDE

(GSoC 2015) Merged in color space picking GUI.

So, after the Tangent Normal Brush was merged, Krita didn’t have any new releases because it was decided to do some major bugfixing. Which in turn means I haven’t had any bugreports yet.

That meant that for the rest of my GSoC, I instead worked on a secondary project: An improved GUI/Widget for picking profiles in Krita, which I merged today.

Colour Management in Krita is pretty central. You cannot have an unmanaged image in Krita, it automatically attaches a colourspace to it, much to the annoyance of many people who attempt to use Krita as a photo-manipulation type of software instead of a drawing software, which it explicitly is, but I digress.

Krita’s old widget for picking a colourspace was a set of comboboxes, allowing you to pick model, bit depth and profile, which has served well for many years. However Artists often have no clue what profiles and color spaces are, so the widget was a little mystifying to them(to the point we had several requests to get rid of that widget, because it was obviously only for minor corner cases).

On the code side, having a new widget was actually pretty beneficial as well. Krita uses LCMS to deal with ICC profiles, but while it could retrieve a transform, and a name, it couldn’t retrieve information like the whitepoint and colorants. The latter of these is actually quite useful for filters and determining the luminance of a colour, which in turn helps with making powerful colour adjustment filters. And the best way to test if you’ve retrieved that kind of data correctly is by making a widget that gives you more information.

With that in mind, the following widget was made:

  • The center widget was ported from DigiKam. This widget allows people to see where the white point is on the CIE xy visible color diagram, as well, if available, how the red, green and blue of RGB profiles map onto it. My primary contribution to this was removing the lcms code from the widget and make it more general(as we would be retrieving the data via pigment) and generally making the widget a little bit more readable by adding some extra ellipses, darkening some colors, etc. I want to extend it further in the future.
  • To the left is an improved version of our old widget. The profile combox got turned into a list, because this is a little easier to read for a lot of files, especially ones that are similarly named like ours are due to Elle Stone’s profiles we ship. Profiles are also alphabetised and the default profile is now marked with a ‘(Default)’.
  • The Profile Properties box gives the raw info that was retrieved. Now, currently it only gives an Estimated Gamma, which is an LCMS function, but apparantly LCMS can’t discern between sRGBtrc, L*trc and rec 709 trc. These are all pretty alike, so I can’t blame it, but the subtle difference can mean a lot to someone who care about the numbers. I want to replace it with a tone response curve widget, though it may proove equally difficult to do right…
  • Getting the right whitepoint and colorants was actually tricky. Turns out that newer versions of LCMS support V4 profiles, which don’t store the actual whitepoint, but instead store the d50 whitepoint, and then store a chromatic adaption matrix that adapts from the actual whitepoint to D50. So to get the actual white point, you need get chromatic adaption matrix, invert it, and multiply it with the whitepoint stored in a matrix. This little detour in makes our resultant XYZ coordinates have rounding errors, which, while minor, are annoying, and I sort of agree with the LCMS people that the V4 specs are kinda obnoxious. As I never had matrices in school, I emailed back and forth with Elle for a bit.
  • I made a little function that tries to find the name of the whitepoint based on the xyY coordinates. It’s not perfect, especially because of those rounding errors mentioned earlier, but it should give a much better readable result. In the worst case hovering over the whitepoint gives a tooltip with the xyY coordinates.
  • The text-box below gives information on the profile if available. So the name, but information on the color model, general information on the bitdepth, and notes from Elle if available. This is a bit of a weight on the translators so I tried to give as many translation comments as possible.

The first reaction to this widget was ‘this is awesome’, and then there were a couple ‘this is a wall of text, no one is going to read that’, but I don’t think they were getting the point.

Anyway, it’s merged, so the next version of Krita will have this GUI. Hope it’ll be of use.

I will sent a mail to the LCMS mailing list because I want to give better feedback on non-RGB color spaces, but one of their functions is confusing me.

Old Google Plus Comments

Scott Petrovic
awesome job Wolthera. This is going to be really helpful for a lot of people confused over the ICC profiles.

By Wolthera

Artist, Krita manual writer, Color Management expert and also busy with comics creation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.