Movatterモバイル変換


[0]ホーム

URL:


Operator index > By section > Colour[src]

These operators let you transform coordinates and images between colourspaces, calculate colour differences, and move to 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-bitRGB, 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 intheHDR imaging community.

The colour functions can be divided into three main groups. First,functions to transform images between the different colour spaces supportedby libvips: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 a target colourspaceusing the best sequence of colour transform operations.

Secondly, there are a set of operations for calculating colour differencemetrics. Finally, libvips wraps LittleCMS and uses it to provide a set ofoperations for reading and writing images withICC profiles.

This figure shows how the libvips colour spaces interconvert:

Interconvert

The colour spaces supported by libvips are:

  • VIPS_INTERPRETATION_LAB:CIELAB ‘76 colourspace with a D65 white. This uses three floats for each band, and bands have the obvious range.

    There are two variants,VIPS_INTERPRETATION_LABQ andVIPS_INTERPRETATION_LABS, which use ints to store values. These are less precise, but can be quicker to store and process.

    VIPS_INTERPRETATION_LCH is the same, but with a*b* as polar coordinates. Hue is expressed in degrees.

  • VIPS_INTERPRETATION_XYZ:CIEXYZ. This uses three floats. SeeVIPS_D75_X0 and friends for values for the ranges under various illuminants.

    VIPS_INTERPRETATION_YXY is the same, but with little x and y.

  • VIPS_INTERPRETATION_scRGB: a linear colourspace with the sRGB primaries. This is useful if you need linear light and don’t care much 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 ofRGB.

    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 useHSV if you have to.

  • VIPS_INTERPRETATION_B_W: a monochrome image, roughly G from sRGB. The grey value is calculated in linearVIPS_INTERPRETATION_scRGB space withRGB ratios 0.2126, 0.7152, 0.0722 as defined byCIE 1931 linear luminance.

    VIPS_INTERPRETATION_GREY16 is the same, but using 16 bits.

  • VIPS_INTERPRETATION_CMC: a colour space based on theCMC(1:1) colour difference measurement. This is a highly uniform colour space, and much better thanCIELAB for expressing small differences.

    TheCMC colourspace is described in “Uniform Colour Space Based on theCMC(l:c) Colour-difference Formula”, M R Luo and B Rigg, Journal of the Society of Dyers and Colourists, vol 102, 1986. Distances in this colourspace approximate, within 10% or so, differences in theCMC(l:c) colour difference formula.

    You can calculate metrics likeCMC(2:1) by scaling the spaces before finding differences.

Functions

Constants

Enumerations


[8]ページ先頭

©2009-2025 Movatter.jp