---
name: "im_XYZ2disp"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.20.7-1+b3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/im_XYZ2disp"
---

# im\_XYZ2disp(3)

convert images between various colour spaces

## NAME

im\_XYZ2disp, im\_disp2XYZ, im\_Lab2XYZ, im\_XYZ2Lab, im\_XYZ2Yxy, im\_Yxy2XYZ, im\_XYZ2sRGB, im\_sRGB2XYZ, im\_Lab2LCh, im\_LCh2Lab, im\_LCh2UCS, im\_UCS2LCh - convert images between  various colour spaces

## SYNOPSIS

\#include \<vips/vips.h\>

int im\_XYZ2disp(in, out, display)\
 IMAGE \*in, \*out;\
 struct im\_col\_display \*display;

int im\_disp2XYZ(in, out, display)\
 IMAGE \*in, \*out;\
 struct im\_col\_display \*display;

int im\_Lab2XYZ(in, out)\
 IMAGE \*in, \*out;

int im\_XYZ2Lab(in, out)\
 IMAGE \*in, \*out;

int im\_XYZ2Yxy(in, out)\
 IMAGE \*in, \*out;

int im\_Yxy2XYZ(in, out)\
 IMAGE \*in, \*out;

int im\_XYZ2sRGB(in, out)\
 IMAGE \*in, \*out;

int im\_sRGB2XYZ(in, out)\
 IMAGE \*in, \*out;

int im\_Lab2LCh(in, out)\
 IMAGE \*in, \*out;

int im\_LCh2Lab(in, out)\
 IMAGE \*in, \*out;

int im\_LCh2UCS(in, out)\
 IMAGE \*in, \*out;

int im\_UCS2LCh(in, out)\
 IMAGE \*in, \*out;

## DESCRIPTION

Functions to convert images between the different colour spaces supported by VIPS: RGB, sRGB, XYZ, Yxy, Lab, LCh and UCS. RGB and sRGB are three band uchar files. XYZ, Lab, LCh and UCS are three band float files.

These are the basic conversion routines provided by VIPS. Other conversions, such as [im\_Lab2disp(3)](/im_Lab2disp/3.md), are built by composing these functions and are provided as a convenience to the programmer.

The VIPS colour spaces inter-convert as follows:

                        \+------- sRGB\
                         \|\
   LabQ ----- Lab ----- XYZ ----- RGB\
    \|          \|         \|\
    \|          \|         +------- Yxy\
    \|          \|\
    \|          +------- LCh ----- UCS\
    \|\
    \+-------- LabS

The colour spaces are:

LabQ --- This is the principal VIPS colorimetric storage format. See [im\_LabQ2Lab(3)](/im_LabQ2Lab/3.md) for an explanation. You cannot perform calculations on LabQ images. They are for storage only.

LabS --- This format represents coordinates in CIE Lab space as 16-bit integers. It is the best format for computation, being relatively compact, quick, and accurate. Colour values expressed in this way are hard to visualise. See the page for im\_LabQ2LabS().

Lab --- Coordinates in CIE Lab space are represented as float values in the usual range. This is the easiest format for general work: adding 50 to the L channel, for example, has the expected result.

XYZ --- CIE XYZ colour space.

Yxy --- CIE Yxy colour space.

RGB --- This format is compatible with 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 vips2TIFF(1). You need to supply a structure which characterises your display. See the manual page for [im\_col\_XYZ2rgb(3)](/im_col_XYZ2rgb/3.md) for hints on these guys.

sRGB --- This is a standard RGB, as defined by:

  http://www.color.org/contrib/sRGB.html

it's handy for carrying colour information through JPEG compressors, for example.

LCh --- Like Lab, but the rectangular ab coordinates are replaced with the polar Ch (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 Lab for expressing small differences. Conversions to and from UCS are extremely slow.

These conversions set the Type field in the image header to LABQ, LABS, LAB, XYZ, RGB, sRGB, LCH and UCS respectively. The Type field is for user information only --- no function reads the Type field to determine its behaviour.  Visualisation programs, such as ip(1), use the Type field to help present the information to the user.

All VIPS colour spaces are based around D65.

VIPS has functions for finding colour difference images. See [im\_dE\_fromLab(3)](/im_dE_fromLab/3.md).

## RETURN VALUE

The functions return 0 on success and -1 on error.

## SEE ALSO

[im\_col\_XYZ2rgb(3)](/im_col_XYZ2rgb/3.md), [im\_dE\_fromLab(3)](/im_dE_fromLab/3.md), [im\_LabQ2Lab(3)](/im_LabQ2Lab/3.md), [im\_Lab2disp(3)](/im_Lab2disp/3.md).

## COPYRIGHT

National Gallery and Birkbeck College, 1990 - 1993

## AUTHOR

K. Martinez - 2/12/1992\
 J. Cupitt - 21/7/93
