ST_SetColorInterp

更新时间:
复制 MD 格式

Sets the color interpretation type for a specified band of a raster object. Returns the modified raster object.

Syntax

raster ST_SetColorInterp(raster rast, integer band_sn, ColorInterp interp)

Parameters

ParameterDescription
rastThe raster object.
band_snThe sequence number of the band. Band numbering starts at 0.
interpThe color interpretation type. See the ColorInterp values table.

ColorInterp values

The following tables list the valid values for the interp parameter, grouped by color model.

General

ValueDescription
UndefinedColor interpretation is not defined.

Indexed color

ValueDescription
GrayIndexIndex into a gray color table.
RGBIndexIndex into an RGB color table.
RGBAIndexIndex into an RGBA color table.
CMYKIndexIndex into a CMYK color table.
HSLIndexIndex into an HSL color table.

RGB and RGBA color models

ValueDescription
RedBandRed band in the RGB color model.
GreenBandGreen band in the RGB color model.
BlueBandBlue band in the RGB color model.
AlphaBandAlpha band in the RGBA color model.

HSL color model

ValueDescription
HueBandHue band in the HSL color model.
SaturationBandSaturation band in the HSL color model.
LightnessBandLightness band in the HSL color model.

CMYK color model

ValueDescription
CyanBandCyan band in the CMYK color model.
MagentaBandMagenta band in the CMYK color model.
YellowBandYellow band in the CMYK color model.
BlackBandBlack band in the CMYK color model.

YCbCr color model

ValueDescription
YBandY (luminance) band in the YCbCr color model.
CbBandCb (chroma blue) band in the YCbCr color model.
CrBandCr (chroma red) band in the YCbCr color model.

Examples

Set band 0 of the raster column rast to the cyan band of the CMYK color model.

When passing a ColorInterp value as a string literal in SQL, use the CI_ prefix form (for example, 'CI_Cyan' for CyanBand). To read back the color interpretation after setting it, use ST_ColorInterp.
UPDATE rast SET rast = ST_SetColorInterp(rast, 0, 'CI_Cyan');

Output:

(1 row)

See also