HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
(Color space conversions)

Functions

ImageBuf OIIO_API ImageBufAlgo::colorconvert (const ImageBuf &src, string_view fromspace, string_view tospace, bool unpremult=true, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 Transform between named color spaces, returning an ImageBuf result. More...
 
ImageBuf OIIO_API ImageBufAlgo::colorconvert (const ImageBuf &src, const ColorProcessor *processor, bool unpremult, ROI roi={}, int nthreads=0)
 Transform using a ColorProcessor, returning an ImageBuf result. More...
 
bool OIIO_API ImageBufAlgo::colorconvert (ImageBuf &dst, const ImageBuf &src, string_view fromspace, string_view tospace, bool unpremult=true, string_view context_key="", string_view context_value="", ColorConfig *colorconfig=nullptr, ROI roi={}, int nthreads=0)
 Transform between named color spaces, storing reults into an existing ImageBuf. More...
 
bool OIIO_API ImageBufAlgo::colorconvert (ImageBuf &dst, const ImageBuf &src, const ColorProcessor *processor, bool unpremult, ROI roi={}, int nthreads=0)
 Transform using a ColorProcessor, storing reults into an existing ImageBuf. More...
 
bool OIIO_API ImageBufAlgo::colorconvert (span< float > color, const ColorProcessor *processor, bool unpremult)
 
bool ImageBufAlgo::colorconvert (float *color, int nchannels, const ColorProcessor *processor, bool unpremult)
 

Detailed Description

Convert between color spaces

Return (or copy into dst) the pixels of src within the ROI, applying a color space transformation. In-place operations (dst == src) are supported.

The first three channels are presumed to be the color to be transformed, and the fourth channel (if it exists) is presumed to be alpha. Any additional channels will be simply copied unaltered.

If OIIO was built with OpenColorIO support enabled, then the transformation may be between any two spaces supported by the active OCIO configuration, or may be a "look" transformation created by ColorConfig::createLookTransform. If OIIO was not built with OpenColorIO support enabled, then the only transformations available are from "sRGB" to "linear" and vice versa.

Parameters
fromspace/tospaceFor the varieties of colorconvert() that use named color spaces, these specify the color spaces by name.
context_key/context_valueFor the varieties of colorconvert() that use named color spaces, these optionally specify a "key" name/value pair to establish a context (for example, a shot-specific transform).
processorFor the varieties of colorconvert() that have a processor paramater, it is a raw ColorProcessor* object that implements the color transformation. This is a special object created by a ColorConfig (see OpenImageIO/color.h for details).
unpremultIf true, unpremultiply the image (divide the RGB channels by alpha if it exists and is nonzero) before color conversion, then repremult after the after the color conversion. Passing unpremult=false skips this step, which may be desirable if you know that the image is "unassociated alpha" (a.k.a., "not pre-multiplied colors").
colorconfigAn optional ColorConfig* specifying an OpenColorIO configuration. If not supplied, the default OpenColorIO color configuration found by examining the $OCIO environment variable will be used instead.

Function Documentation

ImageBuf OIIO_API ImageBufAlgo::colorconvert ( const ImageBuf src,
string_view  fromspace,
string_view  tospace,
bool  unpremult = true,
string_view  context_key = "",
string_view  context_value = "",
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Transform between named color spaces, returning an ImageBuf result.

ImageBuf OIIO_API ImageBufAlgo::colorconvert ( const ImageBuf src,
const ColorProcessor processor,
bool  unpremult,
ROI  roi = {},
int  nthreads = 0 
)

Transform using a ColorProcessor, returning an ImageBuf result.

bool OIIO_API ImageBufAlgo::colorconvert ( ImageBuf dst,
const ImageBuf src,
string_view  fromspace,
string_view  tospace,
bool  unpremult = true,
string_view  context_key = "",
string_view  context_value = "",
ColorConfig colorconfig = nullptr,
ROI  roi = {},
int  nthreads = 0 
)

Transform between named color spaces, storing reults into an existing ImageBuf.

bool OIIO_API ImageBufAlgo::colorconvert ( ImageBuf dst,
const ImageBuf src,
const ColorProcessor processor,
bool  unpremult,
ROI  roi = {},
int  nthreads = 0 
)

Transform using a ColorProcessor, storing reults into an existing ImageBuf.

bool OIIO_API ImageBufAlgo::colorconvert ( span< float color,
const ColorProcessor processor,
bool  unpremult 
)

Apply a color transform in-place to just one color: color[0..nchannels-1]. nchannels should either be 3 or 4 (if 4, the last channel is alpha).

bool ImageBufAlgo::colorconvert ( float color,
int  nchannels,
const ColorProcessor processor,
bool  unpremult 
)
inline

Definition at line 1769 of file imagebufalgo.h.