Next: 2.5 Conversion Up: 2. VIPS packages Previous: 2.3 Boolean Contents

# 2.4 Colour

See figure 2.5.

The colour functions can be divided into two main types. First, functions to transform images between the different colour spaces supported by VIPS: `RGB` (also referred to as `disp`), `sRGB`, `XYZ`, `Yxy`, `Lab`, `LabQ`, `LabS`, `LCh` and `UCS`), and second, functions for calculating colour difference metrics. Figure 2.4 shows how the VIPS colour spaces interconvert.

Figure 2.4: VIPS colour space conversion

The colour spaces supported by VIPS are:

`LabQ`
  This is the principal VIPS colorimetric storage format. See the man page for `im_LabQ2Lab()` for an explanation. You cannot perform calculations on `LabQ` images. They are for storage only. Also refered to as `LABPACK`.

`LabS`
  This format represents coordinates in CIE space as a three- band `IM_BANDFMT_SHORT` image, scaled to fit the full range of bits. It is the best format for computation, being relatively compact, quick, and accurate. Colour values expressed in this way are hard to visualise.

`Lab`
  `Lab` colourspace represents CIE colour values with a three-band `IM_BANDFMT_FLOAT` image. This is the simplest format for general work: adding the constant 50 to the L channel, for example, has the expected result.

`XYZ`
  CIE XYZ colour space represented as a three-band `IM_BANDFMT_FLOAT` image.

`XYZ`
  CIE Yxy colour space represented as a three-band `IM_BANDFMT_FLOAT` image.

`RGB`
  (also refered to as `disp`) This format is similar to the RGB colour systems used in other packages. If you want to export your image to a PC, for example, convert your colorimetric image to `RGB`, then turn it to TIFF with `im_vips2tiff()`. You need to supply a structure which characterises your display. See the manual page for `im_col_XYZ2rgb()` for hints on these guys.

  VIPS also supports `sRGB`. This is a version of RGB with a carefully defined and standard conversion from XYZ. See:

      http://www.color.org/

`LCh`
  Like `Lab`, but rectangular coordinates are replaced with polar (Chroma and hue) coordinates. Hue angles are expressed in degrees.

`UCS`
  A colour space based on the CMC(1:1) colour difference measurement. This is a highly uniform colour space, much better than CIE for expressing small differences. Conversions to and from `UCS` are extremely slow.

All VIPS colourspaces assume a D65 illuminant.

The colour-difference functions calculate either CIE (1976 or 2000) or CMC(1:1) on two images in `Lab`, `XYZ` or `disp` colour space.

Figure 2.5: Colour functions

Next: 2.5 Conversion Up: 2. VIPS packages Previous: 2.3 Boolean Contents