Home > Krita, Open Source > Pigment’s Color Conversion System

Pigment’s Color Conversion System

Pigment is the new name of what was KritaColor in the good old 1.6 days. With some improvements, like a cleaner API, and more shared source code, mostly thanks to templates (in 1.6, more than 60% of the code was duplicated, either directly in the library or in the various plugins).

One of the biggest drawback was color conversion. KritaColor was created to abstract color, in such way that filters, tools or any other algorithms in Krita didn’t have to care about the color space of an image. And in fact, it was first conceived around the lcms library, which is a color management library which handles ICC color space, that means RGB, CMYK, LAB, grayscale,… in integer 8bit or 16bit. But Krita also supports High-Dynamic Range color space, which are mostly floating points color space in 16bit or 32bit. And unfortunately in KritaColor, when a color space was not handled by lcms, colors were first convert to LAB/Integer 16bit, but that meant losing High-Dynamic Range information, as for those color space a lot of important information is stored near 0.0 or above 1.0, information lost when converting to an integer color space, not counting the conversion from 32bit to 16bit.

But I want Krita 2(.0) to be a reliable, high quality, extra, super, cool, (put here any other positive term) High-Dynamic Range imaging application. And thanks to the introduction, during the last few week, of the Color Conversion System (CCS), it’s now possible to have reliable color conversion between two High-Dynamic Range color spaces. And that’s cool, because one of the main task in the High-Dynamic Range work flow is to convert to Low-Dynamic Range (a process called tonemapping), but most algorithms to accomplish that task use the XYZ color space, while most images are in RGB, that means that the image first need to be converted to XYZ (and now you understand why it is interesting to keep the High-Dynamic Range information).

I can’t really make a screen shot of color conversion, so to prove that I can make boring and obscure illustration, here is the graph of direct color conversion in pigment:

The annoyance is that you can’t expect author of a color space to provide a color conversion for each other color spaces. So there must be a mechanism to create a link of color conversion from one color space to an other one. So the main task of the Color Conversion System is to create the graph of possible color conversion, and to use it to find the best color conversion.

  1. Seb Ruiz
    14 October, 2007 at 23:07

    That graph looks impressively sophisticated!

  2. Mark
    15 October, 2007 at 04:39

    This seems rather “over” complicated. You shouldn’t need each author to support converting to every other format. Why not pick one common format that they all can be converted to/from ? If you pick one of the HDR formats you should then be able to convert from anything to anything without image degradation correct ?

  3. Benoit
    15 October, 2007 at 05:33

    Great job Cyrille! Good to have you working on that stuff! I’m not myself in a position to understand all the subtlety but at least I understand it is an essential part of a modern imaging app.

  4. Cyrille Berger
    15 October, 2007 at 07:47

    @mark, it’s very difficult to find a common format that will work accurately for all format. For instance, ICC defines two of them LAB and XYZ, a spectral color space could be a solution, but then it would be awfully complicated to write a color transformation. You also wants to have direct connection whenever it is possible, mostly for speed reason.

  5. sim0n
    15 October, 2007 at 12:06

    Great Job! 🙂I’m not really into this color stuff, but I was wondering if you had a look at gegl ? (http://www.gegl.org)It does pretty much all the work, like color conversion to just like any format and from any format.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: