Top | Description | Object Hierarchy | ![]() | ![]() | ![]() | ![]() |
#define | VIPS_D93_X0 |
#define | VIPS_D93_Y0 |
#define | VIPS_D93_Z0 |
#define | VIPS_D75_X0 |
#define | VIPS_D75_Y0 |
#define | VIPS_D75_Z0 |
#define | VIPS_D65_X0 |
#define | VIPS_D65_Y0 |
#define | VIPS_D65_Z0 |
#define | VIPS_D55_X0 |
#define | VIPS_D55_Y0 |
#define | VIPS_D55_Z0 |
#define | VIPS_D50_X0 |
#define | VIPS_D50_Y0 |
#define | VIPS_D50_Z0 |
#define | VIPS_A_X0 |
#define | VIPS_A_Y0 |
#define | VIPS_A_Z0 |
#define | VIPS_B_X0 |
#define | VIPS_B_Y0 |
#define | VIPS_B_Z0 |
#define | VIPS_C_X0 |
#define | VIPS_C_Y0 |
#define | VIPS_C_Z0 |
#define | VIPS_E_X0 |
#define | VIPS_E_Y0 |
#define | VIPS_E_Z0 |
#define | VIPS_D3250_X0 |
#define | VIPS_D3250_Y0 |
#define | VIPS_D3250_Z0 |
enum | VipsIntent |
enum | VipsPCS |
These operators let you transform coordinates and images between colourspaces, calculate colour differences, and moveto and from device spaces.
All operations process colour from the first few bands and pass other bandsthrough unaltered. This means you can operate on images with alpha channelssafely. If you move to or from 16-bit RGB, any alpha channels are rescaledfor you.
Radiance images have four 8-bits bands and store 8 bits of R, G and B andanother 8 bits of exponent, common to all channels. They are widely used inthe HDR imaging community.
The colour functions can be divided into three main groups. First,functions to transform images between the different colour spaces supportedby VIPS:VIPS_INTERPRETATION_sRGB,VIPS_INTERPRETATION_scRGB,VIPS_INTERPRETATION_B_W,VIPS_INTERPRETATION_XYZ,VIPS_INTERPRETATION_YXY,VIPS_INTERPRETATION_LAB,VIPS_INTERPRETATION_LCH, andVIPS_INTERPRETATION_CMC.
There are also a set of minor colourspaces which are one of the above in aslightly different format:VIPS_INTERPRETATION_LAB,VIPS_INTERPRETATION_LABQ,VIPS_INTERPRETATION_LABS,VIPS_INTERPRETATION_LCH,VIPS_INTERPRETATION_RGB16, andVIPS_INTERPRETATION_GREY16.
Usevips_colourspace()
to move an image to atarget colourspace using the best sequence of colour transform operations.
Secondly, there are a set of operations forcalculating colour difference metrics. Finally, VIPS wraps LittleCMS anduses it to provide a set of operations for reading and writing images withICC profiles.
This figure shows how the VIPS colour spaces interconvert:
The colour spaces supported by VIPS are:
VIPS_INTERPRETATION_LAB -- CIELAB '76 colourspace with a D65 white. Thisuses three floats for each band, and bands have the obvious range.
There are twovariants,VIPS_INTERPRETATION_LABQ andVIPS_INTERPRETATION_LABS, whichuse ints to store values. These are less precise, but can be quicker tostore and process.
VIPS_INTERPRETATION_LCH is the same, but with a*b* as polar coordinates.Hue is expressed in degrees.
VIPS_INTERPRETATION_XYZ -- CIE XYZ. This uses three floats.SeeVIPS_D75_X0 and friends for values for the rangesunder various illuminants.
VIPS_INTERPRETATION_YXY is the same, but with little x and y.
VIPS_INTERPRETATION_scRGB -- a linear colourspace with the sRGBprimaries. This is useful if you need linear light and don't caremuch what the primaries are.
Linearization is performed with the usual sRGB equations, see below.
VIPS_INTERPRETATION_sRGB -- the standard sRGB colourspace, see:wikipedia sRGB.
This uses three 8-bit values for each of RGB.
VIPS_INTERPRETATION_RGB16 is the same, but using three 16-bit values forRGB.
VIPS_INTERPRETATION_HSV is sRGB, but in polar coordinates.VIPS_INTERPRETATION_LCH is much better, only use HSV if you have to.
VIPS_INTERPRETATION_B_W -- a monochrome image, roughly G from sRGB.The grey value iscalculated in linearVIPS_INTERPRETATION_scRGB space with RGB ratios0.2126, 0.7152, 0.0722 as defined by CIE 1931 linear luminance.
VIPS_INTERPRETATION_GREY16 is the same, but using 16 bits.
VIPS_INTERPRETATION_CMC -- a colour space based on the CMC(1:1)colour difference measurement. This is a highly uniform colour space,and much better than CIELAB for expressing small differences.
The CMC colourspace is described in "Uniform Colour Space Based on theCMC(l:c) Colour-difference Formula", M R Luo and B Rigg, Journal of theSociety of Dyers and Colourists, vol 102, 1986. Distances in thiscolourspace approximate, within 10% or so, differences in the CMC(l:c)colour difference formula.
You can calculate metrics like CMC(2:1) by scaling the spaces beforefinding differences.
gbooleanvips_colourspace_issupported (constVipsImage *image
);
Test ifimage
is in a colourspace thatvips_colourspace()
can process.
intvips_colourspace (VipsImage *in
,VipsImage **out
,VipsInterpretation space
,...
);
Optional arguments:
source_space
: input colour space
This operation looks at the interpretation field ofin
(or usessource_space
, if set) and runsa set of colourspace conversion functions to move it tospace
.
For example, given an image tagged asVIPS_INTERPRETATION_YXY, runningvips_colourspace()
withspace
set toVIPS_INTERPRETATION_LAB willconvert withvips_Yxy2XYZ()
andvips_XYZ2Lab()
.
See also:vips_colourspace_issupported()
,vips_image_guess_interpretation()
.
in | input image | |
out | output image. | [out] |
space | convert to this colour space | |
... |
|
intvips_LabQ2sRGB (VipsImage *in
,VipsImage **out
,...
);
Unpack a LabQ (VIPS_CODING_LABQ) image to a three-band short image.
See also:vips_LabS2LabQ()
,vips_LabQ2sRGB()
,vips_rad2float()
.
intvips_rad2float (VipsImage *in
,VipsImage **out
,...
);
Unpack a RAD (VIPS_CODING_RAD) image to a three-band float image.
See also:vips_float2rad()
,vips_LabQ2LabS()
.
intvips_float2rad (VipsImage *in
,VipsImage **out
,...
);
Convert a three-band float image to Radiance 32-bit packed format.
See also:vips_rad2float()
,VIPS_CODING_RAD,vips_LabQ2Lab()
.
intvips_LabS2LabQ (VipsImage *in
,VipsImage **out
,...
);
Convert a LabS three-band signed short image to LabQ
See also:vips_LabQ2LabS()
.
intvips_LabQ2LabS (VipsImage *in
,VipsImage **out
,...
);
Unpack a LabQ (VIPS_CODING_LABQ) image to a three-band short image.
See also:vips_LabS2LabQ()
,vips_LabQ2LabS()
,vips_rad2float()
.
intvips_LabQ2Lab (VipsImage *in
,VipsImage **out
,...
);
Unpack a LabQ (VIPS_CODING_LABQ) image to a three-band float image.
See also:vips_LabQ2Lab()
,vips_LabQ2LabS()
,vips_rad2float()
.
intvips_Lab2LabQ (VipsImage *in
,VipsImage **out
,...
);
Convert a Lab three-band float image to LabQ (VIPS_CODING_LABQ).
See also:vips_LabQ2Lab()
.
intvips_Lab2XYZ (VipsImage *in
,VipsImage **out
,...
);
Optional arguments:
temp
:VipsArrayDouble, colour temperature
Turn Lab to XYZ. The colour temperature defaults to D65, but can bespecified withtemp
.
intvips_XYZ2Lab (VipsImage *in
,VipsImage **out
,...
);
Optional arguments:
temp
:VipsArrayDouble, colour temperature
Turn XYZ to Lab, optionally specifying the colour temperature.temp
defaults to D65.
intvips_scRGB2sRGB (VipsImage *in
,VipsImage **out
,...
);
Optional arguments:
depth
: depth of output image in bits
Convert an scRGB image to sRGB. Setdepth
to 16 to get 16-bit output.
Ifdepth
is 16, any extra channels after RGB aremultiplied by 256.
See also:vips_LabS2LabQ()
,vips_sRGB2scRGB()
,vips_rad2float()
.
intvips_scRGB2BW (VipsImage *in
,VipsImage **out
,...
);
Optional arguments:
depth
: depth of output image in bits
Convert an scRGB image to greyscale. Setdepth
to 16 to get 16-bit output.
Ifdepth
is 16, any extra channels after RGB aremultiplied by 256.
See also:vips_LabS2LabQ()
,vips_sRGB2scRGB()
,vips_rad2float()
.
intvips_sRGB2scRGB (VipsImage *in
,VipsImage **out
,...
);
Convert an sRGB image to scRGB. The input image can be 8 or 16-bit.
If the input image is tagged asVIPS_INTERPRETATION_RGB16, any extrachannels after RGB are divided by 256. Thus, scRGB alpha isalways 0 - 255.99.
See also:vips_scRGB2XYZ()
,vips_scRGB2sRGB()
,vips_rad2float()
.
intvips_HSV2sRGB (VipsImage *in
,VipsImage **out
,...
);
Convert HSV to sRGB.
HSV is a crude polar coordinate system for RGB images. It is provided forcompatibility with other image processing systems. Seevips_Lab2LCh()
for amuch better colour space.
See also:vips_sRGB2HSV()
.
intvips_sRGB2HSV (VipsImage *in
,VipsImage **out
,...
);
Convert to HSV.
HSV is a crude polar coordinate system for RGB images. It is provided forcompatibility with other image processing systems. Seevips_Lab2LCh()
for amuch better colour space.
See also:vips_HSV2sRGB()
,vips_Lab2LCh()
.
intvips_LCh2CMC (VipsImage *in
,VipsImage **out
,...
);
Turn LCh to CMC.
The CMC colourspace is described in "Uniform Colour Space Based on theCMC(l:c) Colour-difference Formula", M R Luo and B Rigg, Journal of theSociety of Dyers and Colourists, vol 102, 1986. Distances in thiscolourspace approximate, within 10% or so, differences in the CMC(l:c)colour difference formula.
This operation generates CMC(1:1). For CMC(2:1), halve Lucs and doubleCucs.
See also:vips_CMC2LCh()
.
intvips_CMC2LCh (VipsImage *in
,VipsImage **out
,...
);
Turn LCh to CMC.
See also:vips_LCh2CMC()
.
intvips_LabS2Lab (VipsImage *in
,VipsImage **out
,...
);
Convert a LabS three-band signed short image to a three-band float image.
See also:vips_LabS2Lab()
.
intvips_Lab2LabS (VipsImage *in
,VipsImage **out
,...
);
Turn Lab to LabS, signed 16-bit int fixed point.
See also:vips_LabQ2Lab()
.
intvips_CMYK2XYZ (VipsImage *in
,VipsImage **out
,...
);
Turn CMYK to XYZ. If the image has an embedded ICC profile this will beused for the conversion. If there is no embedded profile, a genericfallback profile will be used.
Conversion is to D65 XYZ with relative intent. If you need more controlover the process, usevips_icc_import()
instead.
intvips_XYZ2CMYK (VipsImage *in
,VipsImage **out
,...
);
Turn XYZ to CMYK.
Conversion is from D65 XYZ with relative intent. If you need more controlover the process, usevips_icc_export()
instead.
intvips_profile_load (constchar *name
,VipsBlob **profile
,...
);
Load a named profile.
Profiles are loaded from four sources:
The special name"none"
means no profile.profile
will beNULL
in thiscase.
name
can be the name of one of the ICC profiles embedded in libvips.These names can be at least"cmyk"
,"p3"
and"srgb"
.
name
can be the full path to a file.
name
can be the name of an ICC profile in the system profile directoryfor your platform.
name | name of profile to load | |
profile | loaded profile. | [out] |
... |
|
intvips_icc_present (void
);
VIPS can optionally be built without the ICC library. Use this function totest for its availability.
intvips_icc_transform (VipsImage *in
,VipsImage **out
,constchar *output_profile
,...
);
Optional arguments:
pcs
:VipsPCS, use XYZ or LAB PCS
intent
:VipsIntent, transform with this intent
black_point_compensation
:gboolean
, enable black point compensation
embedded
:gboolean
, use profile embedded in input image
input_profile
:gchararray
, get the input profile from here
depth
:gint
, depth of output image in bits
Transform an image with a pair of ICC profiles. The input image is moved toprofile-connection space with the input profile and then to the outputspace with the output profile.
The input profile is searched for in three places:
Ifembedded
is set, libvips will try to use any profile in the inputimage metadata. You can test for the presence of an embedded profilewithvips_image_get_typeof()
withVIPS_META_ICC_NAME as an argument.This will returnGType
0 if there is no profile.
Otherwise, ifinput_profile
is set, libvips will try to load aprofile from the named file. This can aslso be the name of one of thebuilt-in profiles.
Otherwise, libvips will try to pick a compatible profile from the setof built-in profiles.
Ifblack_point_compensation
is set, LCMS black point compensation isenabled.
depth
defaults to 8, or 16 ifin
is a 16-bit image.
The output image has the output profile attached to theVIPS_META_ICC_NAMEfield.
Usevips_icc_import()
andvips_icc_export()
to do either the first orsecond half of this operation in isolation.
in | input image | |
out | output image. | [out] |
output_profile | get the output profile from here | |
... |
|
intvips_icc_import (VipsImage *in
,VipsImage **out
,...
);
Optional arguments:
pcs
:VipsPCS, use XYZ or LAB PCS
intent
:VipsIntent, transform with this intent
black_point_compensation
:gboolean
, enable black point compensation
embedded
:gboolean
, use profile embedded in input image
input_profile
:gchararray
, get the input profile from here
Import an image from device space to D65 LAB with an ICC profile. Ifpcs
isset toVIPS_PCS_XYZ, use CIE XYZ PCS instead.
The input profile is searched for in three places:
Ifembedded
is set, libvips will try to use any profile in the inputimage metadata. You can test for the presence of an embedded profilewithvips_image_get_typeof()
withVIPS_META_ICC_NAME as an argument.This will returnGType
0 if there is no profile.
Otherwise, ifinput_profile
is set, libvips will try to load aprofile from the named file. This can aslso be the name of one of thebuilt-in profiles.
Otherwise, libvips will try to pick a compatible profile from the setof built-in profiles.
Ifblack_point_compensation
is set, LCMS black point compensation isenabled.
intvips_icc_export (VipsImage *in
,VipsImage **out
,...
);
Optional arguments:
pcs
:VipsPCS, use XYZ or LAB PCS
intent
:VipsIntent, transform with this intent
black_point_compensation
:gboolean
, enable black point compensation
output_profile
:gchararray
, get the output profile from here
depth
:gint
, depth of output image in bits
Export an image from D65 LAB to device space with an ICC profile.Ifpcs
isset toVIPS_PCS_XYZ, use CIE XYZ PCS instead.Ifoutput_profile
is not set, use the embedded profile, if any.Ifoutput_profile
is set, export with that and attach it to the outputimage.
Ifblack_point_compensation
is set, LCMS black point compensation isenabled.
intvips_icc_ac2rc (VipsImage *in
,VipsImage **out
,constchar *profile_filename
);
Transform an image from absolute to relative colorimetry using theMediaWhitePoint stored in the ICC profile.
See also:vips_icc_transform()
,vips_icc_import()
.
gbooleanvips_icc_is_compatible_profile (VipsImage *image
,constvoid *data
,size_t data_length
);
intvips_dE76 (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
Calculate dE 76.
left | first input image | |
right | second input image | |
out | output image. | [out] |
... |
|
intvips_dE00 (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
Calculate dE 00.
intvips_dECMC (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
Calculate dE CMC. The input images are transformed to CMC colour space andthe euclidean distance between corresponding pixels calculated.
To calculate a colour difference with values for (l:c) other than (1:1),transform the two source images to CMC yourself, scale the channelsappropriately, and call this function.
See also:vips_colourspace()
left | first input image | |
right | second input image | |
out | output image. | [out] |
... |
|
voidvips_col_Lab2XYZ (float L
,float a
,float b
,float *X
,float *Y
,float *Z
);
Calculate XYZ from Lab, D65.
See also:vips_Lab2XYZ()
.
voidvips_col_XYZ2Lab (float X
,float Y
,float Z
,float *L
,float *a
,float *b
);
Calculate XYZ from Lab, D65.
See also:vips_XYZ2Lab()
.
voidvips_col_Ch2ab (float C
,float h
,float *a
,float *b
);
Calculate ab from Ch, h in degrees.
floatvips_col_Lcmc2L (float Lcmc
);
Calculate L from Lcmc using a table. Callvips_col_make_tables_CMC()
atleast once before using this function.
floatvips_col_Ccmc2C (float Ccmc
);
Calculate C from Ccmc using a table.Callvips_col_make_tables_CMC()
atleast once before using this function.
floatvips_col_Chcmc2h (float C
,float hcmc
);
Calculate h from C and hcmc, using a table.Callvips_col_make_tables_CMC()
atleast once before using this function.
intvips_col_sRGB2scRGB_8_noclip (int r
,int g
,int b
,float *R
,float *G
,float *B
);
intvips_col_sRGB2scRGB_16_noclip (int r
,int g
,int b
,float *R
,float *G
,float *B
);
intvips_col_scRGB2XYZ (float R
,float G
,float B
,float *X
,float *Y
,float *Z
);
Turn scRGB into XYZ.
See also:vips_scRGB2XYZ()
.
intvips_col_XYZ2scRGB (float X
,float Y
,float Z
,float *R
,float *G
,float *B
);
Turn XYZ into scRGB.
See also:vips_XYZ2scRGB()
.
intvips_col_scRGB2sRGB_8 (float R
,float G
,float B
,int *r
,int *g
,int *b
,int *og
);
intvips_col_scRGB2sRGB_16 (float R
,float G
,float B
,int *r
,int *g
,int *b
,int *og
);
floatvips_pythagoras (float L1
,float a1
,float b1
,float L2
,float a2
,float b2
);
Pythagorean distance between two points in colour space. Lab/XYZ/CMC etc.
floatvips_col_dE00 (float L1
,float a1
,float b1
,float L2
,float a2
,float b2
);
CIEDE2000, from:
Luo, Cui, Rigg, "The Development of the CIE 2000 Colour-DifferenceFormula: CIEDE2000", COLOR research and application, pp 340
#define VIPS_A_X0 (109.8503)
Areas under curves for illuminant A (2856K), 2 degree observer.
#define VIPS_D3250_X0 (105.6590)
Areas under curves for black body at 3250K, 2 degree observer.
The rendering intent.VIPS_INTENT_ABSOLUTE is best forscientific work,VIPS_INTENT_RELATIVE is usually best foraccurate communication with other imaging libraries.
Pick a Profile Connection Space forvips_icc_import()
andvips_icc_export()
. LAB is usually best, XYZ can be more convenient in somecases.