[cairo] RGB to CIELab transformation

Kai-Uwe Behrmann ku.b at gmx.de
Fri Jan 20 03:30:07 PST 2012

Am 20.01.12, 11:55 +0100 schrieb Andrea Canciani:
> On Fri, Jan 20, 2012 at 8:01 AM, Necko Nedjoni <opustenom at hotmail.com> wrote:
>> As a part of a larger project, I was recently assigned to investigate the
>> possibility of colorings
>> within our visualizations.
>> Namely, I came across the CIELab color space, which seems to be preferable
>> choice in the related
>> literature. The initial readings suggest that a conversion from
>> device-depended RGB is possible, and
>> I wonder how this could be achieved with cairo.
> Converting a color in a device-dependent colorspace to a color in a
> device-independent colorspace is not actually a meaningful operation.
> You might assume that the RGB components are in a specific
> device-independent colorspace (given current cairo behavior I would
> suggest a linear rgb colorspace with the same primaries as sRGB or
> sRGB itself).
> You could then use normal color conversion routines, like those
> provided by LittleCMS.

Agreed, it makes sense to normalise from device colours to a blending 
colour space, then do compositing in Cairo and convert into something 
appropriate for output. You suggested sRGB for blending and that is fine 
like with most single gamma profiles like ROMM/ProPhotoRGB and LStarRGB to 
name a few. Necko, you stated to want use Lab, so you might choose a 
bigger gamut than sRGB.

Cairo has no support for colour spaces with asymmetric gamma like CIE*Lab 
during blending. One can expect in Cairo hue changes during blending 
CIE*Lab content.

kind regards
Kai-Uwe Behrmann
developing for colour management 
www.behrmann.name + www.oyranos.org

More information about the cairo mailing list