Transforms

See also: Grading Transforms

Transform

class PyOpenColorIO.Transform

Base class for all the transform classes.

Transform(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

getDirection() PyOpenColorIO.TransformDirection
getTransformType() PyOpenColorIO.TransformType
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

validate() None

Will throw if data is not valid.

AllocationTransform

class PyOpenColorIO.AllocationTransform

Forward direction wraps the ‘expanded’ range into the specified, often compressed, range.

AllocationTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.AllocationTransform) -> None

  2. __init__(self: PyOpenColorIO.AllocationTransform, allocation: PyOpenColorIO.Allocation = <Allocation.ALLOCATION_UNIFORM: 1>, vars: List[float] = [], direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

getAllocation() PyOpenColorIO.Allocation
getDirection() PyOpenColorIO.TransformDirection
getTransformType() PyOpenColorIO.TransformType
getVars() List[float]
setAllocation(allocation: PyOpenColorIO.Allocation) None
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setVars(vars: List[float]) None
validate() None

Will throw if data is not valid.

BuiltinTransform

class PyOpenColorIO.BuiltinTransform

A built-in transform is similar to a FileTransform, but without the file. OCIO knows how to build a set of commonly used transforms on-demand, thus avoiding the need for external files and simplifying config authoring.

BuiltinTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.BuiltinTransform) -> None

  2. __init__(self: PyOpenColorIO.BuiltinTransform, style: str = ‘IDENTITY’, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

getDescription() str
getDirection() PyOpenColorIO.TransformDirection
getStyle() str
getTransformType() PyOpenColorIO.TransformType
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setStyle(style: str) None

Select an existing built-in transform style from the list accessible through :ref:`BuiltinTransformRegistry`. The style is the ID string that identifies which transform to apply.

validate() None

Will throw if data is not valid.

BuiltinTransformRegistry

class PyOpenColorIO.BuiltinTransformRegistry

The built-in transform registry contains all the existing built-in transforms which can be used by a configuration (version 2 or higher only).

BuiltinTransformRegistry() None

Get the current built-in transform registry.

getBuiltins() PyOpenColorIO.BuiltinTransformRegistry.BuiltinIterator
class PyOpenColorIO.BuiltinTransformRegistry.BuiltinStyleIterator
self[arg0: int] str
iter(self) PyOpenColorIO.BuiltinTransformRegistry.BuiltinStyleIterator
len(self) int
next(self) str
class PyOpenColorIO.BuiltinTransformRegistry.BuiltinIterator
self[arg0: int] tuple
iter(self) PyOpenColorIO.BuiltinTransformRegistry.BuiltinIterator
len(self) int
next(self) tuple

CDLTransform

class PyOpenColorIO.CDLTransform

An implementation of the ASC Color Decision List (CDL), based on the ASC v1.2 specification.

ASC_SOP

Slope, offset, power:: out = clamp( (in * slope) + offset ) ^ power

Note

​ If the config version is 1, negative values are clamped if the power is not 1.0. For config version 2 and higher, the negative handling is controlled by the CDL style.

static CreateFromFile(src: str, id: str) PyOpenColorIO.CDLTransform

Load the CDL from the src .cdl, .cc, or .ccc file.

Note

The cccid can be the ID of a CDL or the index of the CDL (as string). If cccid is NULL or empty the first CDL is returned. The cccid is case-sensitive. The src must be an absolute path reference, no relative directory or envvar resolution is performed. Throws if file does not contain any CDL or if the specified cccid is not found.

static CreateGroupFromFile(src: str) PyOpenColorIO.GroupTransform

Load all of the CDLs in a .cdl or .ccc file into a single GroupTransform.

Note

This may be useful as a quicker way for applications to check the contents of each of the CDLs. The src must be an absolute path reference, no relative directory or envvar resolution is performed.

CDLTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.CDLTransform) -> None

  2. __init__(self: PyOpenColorIO.CDLTransform, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

  3. __init__(self: PyOpenColorIO.CDLTransform, slope: List[float[3]] = [1.0, 1.0, 1.0], offset: List[float[3]] = [0.0, 0.0, 0.0], power: List[float[3]] = [1.0, 1.0, 1.0], sat: float = 1.0, id: str = ‘’, description: str = ‘’, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

equals(other: PyOpenColorIO.CDLTransform) bool
getDirection() PyOpenColorIO.TransformDirection
getFirstSOPDescription() str
getFormatMetadata() PyOpenColorIO.FormatMetadata
getID() str

The get/setID methods are now deprecated. The preferred way of interacting with the ID is now via the transform’s formatMetadata.

getOffset() List[float[3]]
getPower() List[float[3]]
getSOP() List[float[9]]
getSat() float
getSatLumaCoefs() List[float[3]]

These are hard-coded, by spec, to r709.

getSlope() List[float[3]]
getStyle() PyOpenColorIO.CDLStyle
getTransformType() PyOpenColorIO.TransformType
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setFirstSOPDescription(description: str) None
setID(id: str) None
setOffset(rgb: List[float[3]]) None
setPower(rgb: List[float[3]]) None
setSOP(vec9: List[float[9]]) None
setSat(sat: float) None
setSlope(rgb: List[float[3]]) None
setStyle(style: PyOpenColorIO.CDLStyle) None

Use CDL_ASC to clamp values to [0,1] per the ASC spec. Use NO_CLAMP to never clamp values (regardless of whether power is 1.0). The NO_CLAMP option passes negatives through unchanged (like the NEGATIVE_PASS_THRU style of ExponentTransform). The default style is CDL_NO_CLAMP.

validate() None

Will throw if data is not valid.

ColorSpaceTransform

class PyOpenColorIO.ColorSpaceTransform
ColorSpaceTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.ColorSpaceTransform) -> None

  2. __init__(self: PyOpenColorIO.ColorSpaceTransform, src: str = ‘’, dst: str = ‘’, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>, dataBypass: bool = True) -> None

getDataBypass() bool

Data color spaces do not get processed when true (which is the default).

getDirection() PyOpenColorIO.TransformDirection
getDst() str
getSrc() str
getTransformType() PyOpenColorIO.TransformType
setDataBypass(dataBypass: bool) None
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setDst(dst: str) None
setSrc(src: str) None
validate() None

Will throw if data is not valid.

DisplayViewTransform

class PyOpenColorIO.DisplayViewTransform
DisplayViewTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.DisplayViewTransform) -> None

  2. __init__(self: PyOpenColorIO.DisplayViewTransform, src: str = ‘’, display: str = ‘’, view: str = ‘’, looksBypass: bool = False, dataBypass: bool = True, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

getDataBypass() bool
getDirection() PyOpenColorIO.TransformDirection
getDisplay() str
getLooksBypass() bool
getSrc() str
getTransformType() PyOpenColorIO.TransformType
getView() str
setDataBypass(dataBypass: bool) None

Data color spaces do not get processed when true (which is the default).

setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setDisplay(display: str) None

Specify which display to use.

setLooksBypass(looksBypass: bool) None

Looks will be bypassed when true (the default is false).

setSrc(src: str) None

Specify the incoming color space.

setView(view: str) None

Specify which view transform to use.

validate() None

Will throw if data is not valid.

ExponentTransform

class PyOpenColorIO.ExponentTransform

Represents exponent transform: pow( clamp(color), value ).

Note

For configs with version == 1: Negative style is ignored and if the exponent is 1.0, this will not clamp. Otherwise, the input color will be clamped between [0.0, inf]. For configs with version > 1: Negative value handling may be specified via setNegativeStyle.

ExponentTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.ExponentTransform) -> None

  2. __init__(self: PyOpenColorIO.ExponentTransform, value: List[float[4]] = [1.0, 1.0, 1.0, 1.0], negativeStyle: PyOpenColorIO.NegativeStyle = <NegativeStyle.NEGATIVE_CLAMP: 0>, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

equals(other: PyOpenColorIO.ExponentTransform) bool

Checks if this exactly equals other.

getDirection() PyOpenColorIO.TransformDirection
getFormatMetadata() PyOpenColorIO.FormatMetadata
getNegativeStyle() PyOpenColorIO.NegativeStyle

Specifies how negative values are handled. Legal values:

  • NEGATIVE_CLAMP – Clamp negative values (default).

  • NEGATIVE_MIRROR – Positive curve is rotated 180 degrees around the origin to handle negatives.

  • NEGATIVE_PASS_THRU – Negative values are passed through unchanged.

getTransformType() PyOpenColorIO.TransformType
getValue() List[float[4]]
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setNegativeStyle(style: PyOpenColorIO.NegativeStyle) None
setValue(value: List[float[4]]) None
validate() None

Will throw if data is not valid.

ExponentWithLinearTransform

class PyOpenColorIO.ExponentWithLinearTransform

Represents power functions with a linear section in the shadows such as sRGB and L*.

The basic formula is:

pow( (x + offset)/(1 + offset), gamma ) with the breakpoint at offset/(gamma - 1).

Negative values are never clamped.

ExponentWithLinearTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.ExponentWithLinearTransform) -> None

  2. __init__(self: PyOpenColorIO.ExponentWithLinearTransform, gamma: List[float[4]] = [1.0, 1.0, 1.0, 1.0], offset: List[float[4]] = [0.0, 0.0, 0.0, 0.0], negativeStyle: PyOpenColorIO.NegativeStyle = <NegativeStyle.NEGATIVE_LINEAR: 3>, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

equals(other: PyOpenColorIO.ExponentWithLinearTransform) bool

Checks if this exactly equals other.

getDirection() PyOpenColorIO.TransformDirection
getFormatMetadata() PyOpenColorIO.FormatMetadata
getGamma() List[float[4]]
getNegativeStyle() PyOpenColorIO.NegativeStyle

Specifies how negative values are handled. Legal values:

  • NEGATIVE_LINEAR – Linear segment continues into negatives (default).

  • NEGATIVE_MIRROR – Positive curve is rotated 180 degrees around the origin to handle negatives.

getOffset() List[float[4]]
getTransformType() PyOpenColorIO.TransformType
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setGamma(values: List[float[4]]) None

Set the exponent value for the power function for R, G, B, A.

Note

The gamma values must be in the range of [1, 10]. Set the transform direction to inverse to obtain the effect of values less than 1.

setNegativeStyle(style: PyOpenColorIO.NegativeStyle) None
setOffset(values: List[float[4]]) None

Set the offset value for the power function for R, G, B, A.

Note

The offset values must be in the range [0, 0.9].

validate() None

Will throw if data is not valid.

ExposureContrastTransform

class PyOpenColorIO.ExposureContrastTransform

Applies exposure, gamma, and pivoted contrast adjustments. Adjusts the math to be appropriate for linear, logarithmic, or video color spaces.

ExposureContrastTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.ExposureContrastTransform) -> None

  2. __init__(self: PyOpenColorIO.ExposureContrastTransform, style: PyOpenColorIO.ExposureContrastStyle = <ExposureContrastStyle.EXPOSURE_CONTRAST_LINEAR: 0>, exposure: float = 0.0, contrast: float = 1.0, gamma: float = 1.0, pivot: float = 0.18, logExposureStep: float = 0.088, logMidGray: float = 0.435, dynamicExposure: bool = False, dynamicContrast: bool = False, dynamicGamma: bool = False, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

equals(other: PyOpenColorIO.ExposureContrastTransform) bool

Checks if this exactly equals other.

getContrast() float
getDirection() PyOpenColorIO.TransformDirection
getExposure() float
getFormatMetadata() PyOpenColorIO.FormatMetadata
getGamma() float
getLogExposureStep() float
getLogMidGray() float
getPivot() float
getStyle() PyOpenColorIO.ExposureContrastStyle
getTransformType() PyOpenColorIO.TransformType
isContrastDynamic() bool

Contrast can be made dynamic so the value can be changed through the CPU or GPU processor, but if there are several ExposureContrastTransform only one can have a dynamic contrast.

isExposureDynamic() bool

Exposure can be made dynamic so the value can be changed through the CPU or GPU processor, but if there are several ExposureContrastTransform only one can have a dynamic exposure.

isGammaDynamic() bool

Gamma can be made dynamic so the value can be changed through the CPU or GPU processor, but if there are several ExposureContrastTransform only one can have a dynamic gamma.

makeContrastDynamic() None
makeContrastNonDynamic() None
makeExposureDynamic() None
makeExposureNonDynamic() None
makeGammaDynamic() None
makeGammaNonDynamic() None
setContrast(contrast: float) None

Applies a contrast/gamma adjustment around a pivot point. The contrast and gamma are mathematically the same, but two controls are provided to enable the use of separate dynamic parameters. Contrast is usually a scene-referred adjustment that pivots around gray whereas gamma is usually a display-referred adjustment that pivots around white.

setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setExposure(exposure: float) None

Applies an exposure adjustment. The value is in units of stops (regardless of style), for example, a value of -1 would be equivalent to reducing the lighting by one half.

setGamma(gamma: float) None
setLogExposureStep(logExposureStep: float) None

Set the increment needed to move one stop for the log-style algorithm. For example, ACEScct is 0.057, LogC is roughly 0.074, and Cineon is roughly 90/1023 = 0.088. The default value is 0.088.

setLogMidGray(logMidGray: float) None

Set the position of 18% gray for use by the log-style algorithm. For example, ACEScct is about 0.41, LogC is about 0.39, and ADX10 is 445/1023 = 0.435. The default value is 0.435.

setPivot(pivot: float) None

Set the pivot point around which the contrast and gamma controls will work. Regardless of whether linear/video/log-style is being used, the pivot is always expressed in linear. In other words, a pivot of 0.18 is always mid-gray.

setStyle(style: PyOpenColorIO.ExposureContrastStyle) None

Select the algorithm for linear, video or log color spaces.

validate() None

Will throw if data is not valid.

FileTransform

class PyOpenColorIO.FileTransform
FileTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.FileTransform) -> None

  2. __init__(self: PyOpenColorIO.FileTransform, src: str = ‘’, cccId: str = ‘’, interpolation: PyOpenColorIO.Interpolation = <Interpolation.INTERP_DEFAULT: 254>, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

getCCCId() str

The cccid can be the ID of a CDL or the index of the CDL (as string). If cccid is NULL or empty the first CDL is returned. The cccid is case-sensitive.

getCDLStyle() PyOpenColorIO.CDLStyle
getDirection() PyOpenColorIO.TransformDirection
static getFormats() PyOpenColorIO.FileTransform.FormatIterator
getInterpolation() PyOpenColorIO.Interpolation

The file parsers that care about interpolation (LUTs) will try to make use of the requested interpolation method when loading the file. In these cases, if the requested method could not be used, a warning is logged. If no method is provided, or a method cannot be used, INTERP_DEFAULT is used.

getSrc() str
getTransformType() PyOpenColorIO.TransformType
setCCCId(cccId: str) None
setCDLStyle(style: PyOpenColorIO.CDLStyle) None

Can be used with CDL, CC & CCC formats to specify the clamping behavior of the CDLTransform. Default is CDL_NO_CLAMP.

setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setInterpolation(interpolation: PyOpenColorIO.Interpolation) None
setSrc(src: str) None
validate() None

Will throw if data is not valid.

class PyOpenColorIO.FileTransform.FormatIterator
self[arg0: int] tuple
iter(self) PyOpenColorIO.FileTransform.FormatIterator
len(self) int
next(self) tuple

FixedFunctionTransform

class PyOpenColorIO.FixedFunctionTransform

Provides a set of hard-coded algorithmic building blocks that are needed to accurately implement various common color transformations.

FixedFunctionTransform(style: PyOpenColorIO.FixedFunctionStyle, params: List[float] = [], direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) None
equals(other: PyOpenColorIO.FixedFunctionTransform) bool

Checks if this exactly equals other.

getDirection() PyOpenColorIO.TransformDirection
getFormatMetadata() PyOpenColorIO.FormatMetadata
getParams() List[float]
getStyle() PyOpenColorIO.FixedFunctionStyle
getTransformType() PyOpenColorIO.TransformType
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setParams(params: List[float]) None

Set the parameters (for functions that require them).

setStyle(style: PyOpenColorIO.FixedFunctionStyle) None

Select which algorithm to use.

validate() None

Will throw if data is not valid.

GroupTransform

class PyOpenColorIO.GroupTransform
static GetWriteFormats() PyOpenColorIO.GroupTransform.WriteFormatIterator
GroupTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.GroupTransform) -> None

  2. __init__(self: PyOpenColorIO.GroupTransform, transforms: List[PyOpenColorIO.Transform] = [], direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

appendTransform(transform: PyOpenColorIO.Transform) None

Adds a transform to the end of the group.

getDirection() PyOpenColorIO.TransformDirection
getFormatMetadata() PyOpenColorIO.FormatMetadata
getTransformType() PyOpenColorIO.TransformType
prependTransform(transform: PyOpenColorIO.Transform) None

Add a transform at the beginning of the group.

setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

validate() None

Will throw if data is not valid.

write(*args, **kwargs)

Overloaded function.

  1. write(self: PyOpenColorIO.GroupTransform, formatName: str, fileName: str, config: PyOpenColorIO.Config = None) -> None

Write the transforms comprising the group to the stream.

Writing (as opposed to Baking) is a lossless process. An exception is thrown if the processor cannot be losslessly written to the specified file format. Transforms such as FileTransform or ColorSpaceTransform are resolved into write-able simple transforms using the config and context. Supported formats include CTF, CLF, and CDL. All available formats can be listed with the following: .. code-block:: cpp

// What are the allowed writing output formats? std::ostringstream formats; formats << “Formats to write to: “; for (int i = 0; i < :ref:`GroupTransform::GetNumWriteFormats`(); ++i) {

if (i != 0) formats << “, “; formats << :ref:`GroupTransform::GetFormatNameByIndex`(i); formats << ” (.” << GroupTransform::GetFormatExtensionByIndex(i) << “)”;

}

  1. write(self: PyOpenColorIO.GroupTransform, formatName: str, config: PyOpenColorIO.Config = None) -> str

Write the transforms comprising the group to the stream.

Writing (as opposed to Baking) is a lossless process. An exception is thrown if the processor cannot be losslessly written to the specified file format. Transforms such as FileTransform or ColorSpaceTransform are resolved into write-able simple transforms using the config and context. Supported formats include CTF, CLF, and CDL. All available formats can be listed with the following: .. code-block:: cpp

// What are the allowed writing output formats? std::ostringstream formats; formats << “Formats to write to: “; for (int i = 0; i < :ref:`GroupTransform::GetNumWriteFormats`(); ++i) {

if (i != 0) formats << “, “; formats << :ref:`GroupTransform::GetFormatNameByIndex`(i); formats << ” (.” << GroupTransform::GetFormatExtensionByIndex(i) << “)”;

}

class PyOpenColorIO.GroupTransform.WriteFormatIterator
self[arg0: int] tuple
iter(self) PyOpenColorIO.GroupTransform.WriteFormatIterator
len(self) int
next(self) tuple
class PyOpenColorIO.GroupTransform.TransformIterator
self[arg0: int] PyOpenColorIO.Transform
iter(self) PyOpenColorIO.GroupTransform.TransformIterator
len(self) int
next(self) PyOpenColorIO.Transform

LogAffineTransform

class PyOpenColorIO.LogAffineTransform

Applies a logarithm with an affine transform before and after. Represents the Cineon lin-to-log type transforms:

logSideSlope * log( linSideSlope * color + linSideOffset, base) + logSideOffset

  • Default values are: 1. * log( 1. * color + 0., 2.) + 0.

  • The alpha channel is not affected.

LogAffineTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.LogAffineTransform) -> None

  2. __init__(self: PyOpenColorIO.LogAffineTransform, logSideSlope: List[float[3]] = [1.0, 1.0, 1.0], logSideOffset: List[float[3]] = [0.0, 0.0, 0.0], linSideSlope: List[float[3]] = [1.0, 1.0, 1.0], linSideOffset: List[float[3]] = [0.0, 0.0, 0.0], direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

equals(other: PyOpenColorIO.LogAffineTransform) bool

Checks if this exactly equals other.

getBase() float
getDirection() PyOpenColorIO.TransformDirection
getFormatMetadata() PyOpenColorIO.FormatMetadata
getLinSideOffsetValue() List[float[3]]
getLinSideSlopeValue() List[float[3]]
getLogSideOffsetValue() List[float[3]]
getLogSideSlopeValue() List[float[3]]
getTransformType() PyOpenColorIO.TransformType
setBase(base: float) None
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setLinSideOffsetValue(values: List[float[3]]) None
setLinSideSlopeValue(values: List[float[3]]) None
setLogSideOffsetValue(values: List[float[3]]) None
setLogSideSlopeValue(values: List[float[3]]) None
validate() None

Will throw if data is not valid.

LogCameraTransform

class PyOpenColorIO.LogCameraTransform

Same as LogAffineTransform but with the addition of a linear segment near black. This formula is used for many camera logs (e.g., LogC) as well as ACEScct.

  • The linSideBreak specifies the point on the linear axis where the log and linear segments meet. It must be set (there is no default).

  • The linearSlope specifies the slope of the linear segment of the forward (linToLog) transform. By default it is set equal to the slope of the log curve at the break point.

LogCameraTransform() None

LinSideBreak must be set for the transform to be valid (there is no default).

equals(other: PyOpenColorIO.LogCameraTransform) bool

Checks if this exactly equals other.

getBase() float
getDirection() PyOpenColorIO.TransformDirection
getFormatMetadata() PyOpenColorIO.FormatMetadata
getLinSideBreakValue() List[float[3]]
getLinSideOffsetValue() List[float[3]]
getLinSideSlopeValue() List[float[3]]
getLinearSlopeValue() List[float[3]]

Return LinearSlope or 3 qnan values if not defined.

getLogSideOffsetValue() List[float[3]]
getLogSideSlopeValue() List[float[3]]

Get/Set values for the R, G, B components.

getTransformType() PyOpenColorIO.TransformType
isLinearSlopeValueSet() bool
setBase(base: float) None
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setLinSideBreakValue(values: List[float[3]]) None
setLinSideOffsetValue(values: List[float[3]]) None
setLinSideSlopeValue(values: List[float[3]]) None
setLinearSlopeValue(values: List[float[3]]) None

Set LinearSlope value.

Note

You must call setLinSideBreakValue before calling this.

setLogSideOffsetValue(values: List[float[3]]) None
setLogSideSlopeValue(values: List[float[3]]) None
unsetLinearSlopeValue() None

Remove LinearSlope values so that default values are used.

validate() None

Will throw if data is not valid.

LogTransform

class PyOpenColorIO.LogTransform

Represents log transform: log(color, base)

  • The input will be clamped for negative numbers.

  • Default base is 2.0.

  • The alpha channel is not affected.

LogTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.LogTransform) -> None

  2. __init__(self: PyOpenColorIO.LogTransform, base: float = 2.0, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

equals(other: PyOpenColorIO.LogTransform) bool

Checks if this exactly equals other.

getBase() float
getDirection() PyOpenColorIO.TransformDirection
getFormatMetadata() PyOpenColorIO.FormatMetadata
getTransformType() PyOpenColorIO.TransformType
setBase(base: float) None
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

validate() None

Will throw if data is not valid.

LookTransform

class PyOpenColorIO.LookTransform
LookTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.LookTransform) -> None

  2. __init__(self: PyOpenColorIO.LookTransform, src: str, dst: str, looks: str = ‘’, skipColorSpaceConversion: bool = False, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

getDirection() PyOpenColorIO.TransformDirection
getDst() str
getLooks() str
getSkipColorSpaceConversion() bool
getSrc() str
getTransformType() PyOpenColorIO.TransformType
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setDst(dst: str) None
setLooks(looks: str) None

Specify looks to apply. Looks is a potentially comma (or colon) delimited list of look names, Where +/- prefixes are optionally allowed to denote forward/inverse look specification. (And forward is assumed in the absence of either)

setSkipColorSpaceConversion(skipColorSpaceConversion: bool) None
setSrc(src: str) None
validate() None

Will throw if data is not valid.

Lut1DTransform

class PyOpenColorIO.Lut1DTransform

Represents a 1D-LUT transform.

Lut1DTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.Lut1DTransform) -> None

Create an identity 1D-LUT of length two.

  1. __init__(self: PyOpenColorIO.Lut1DTransform, length: int, inputHalfDomain: bool) -> None

Create an identity 1D-LUT with specific length and half-domain setting. Will throw for lengths longer than 1024x1024.

  1. __init__(self: PyOpenColorIO.Lut1DTransform, length: int = 2, inputHalfDomain: bool = False, outputRawHalfs: bool = False, fileOutputBitDepth: PyOpenColorIO.BitDepth = <BitDepth.BIT_DEPTH_UNKNOWN: 0>, hueAdjust: PyOpenColorIO.Lut1DHueAdjust = <Lut1DHueAdjust.HUE_NONE: 0>, interpolation: PyOpenColorIO.Interpolation = <Interpolation.INTERP_DEFAULT: 254>, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

Create an identity 1D-LUT with specific length and half-domain setting. Will throw for lengths longer than 1024x1024.

equals(other: PyOpenColorIO.Lut1DTransform) bool

Checks if this exactly equals other.

getData() numpy.ndarray
getDirection() PyOpenColorIO.TransformDirection
getFileOutputBitDepth() PyOpenColorIO.BitDepth
getFormatMetadata() PyOpenColorIO.FormatMetadata
getHueAdjust() PyOpenColorIO.Lut1DHueAdjust
getInputHalfDomain() bool
getInterpolation() PyOpenColorIO.Interpolation
getLength() int
getOutputRawHalfs() bool
getTransformType() PyOpenColorIO.TransformType
getValue(index: int) tuple
setData(data: buffer) None
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setFileOutputBitDepth(bitDepth: PyOpenColorIO.BitDepth) None

Get the bit-depth associated with the LUT values read from a file or set the bit-depth of values to be written to a file (for file formats such as CLF that support multiple bit-depths). However, note that the values stored in the object are always normalized.

setHueAdjust(hueAdjust: PyOpenColorIO.Lut1DHueAdjust) None

The 1D-LUT transform optionally supports a hue adjustment feature that was used in some versions of ACES. This adjusts the hue of the result to approximately match the input.

setInputHalfDomain(isHalfDomain: bool) None

In a half-domain LUT, the contents of the LUT specify the desired value of the function for each half-float value. Therefore, the length of the LUT must be 65536 entries or else validate() will throw.

setInterpolation(interpolation: PyOpenColorIO.Interpolation) None
setLength(length: int) None

Changing the length will reset the LUT to identity. Will throw for lengths longer than 1024x1024.

setOutputRawHalfs(isRawHalfs: bool) None

Set OutputRawHalfs to true if you want to output the LUT contents as 16-bit floating point values expressed as unsigned 16-bit integers representing the equivalent bit pattern. For example, the value 1.0 would be written as the integer 15360 because it has the same bit-pattern. Note that this implies the values will be quantized to a 16-bit float. Note that this setting only controls the output formatting (where supported) and not the values for getValue/setValue. The only file formats that currently support this are CLF and CTF.

setValue(index: int, r: float, g: float, b: float) None

Set the values of a LUT1D. Will throw if the index is outside of the range from 0 to (length-1).

The LUT values are always for the “forward” LUT, regardless of how the transform direction is set.

These values are normalized relative to what may be stored in any given LUT files. For example in a CLF file using a “10i” output depth, a value of 1023 in the file is normalized to 1.0. The values here are unclamped and may extend outside [0,1].

LUTs in various file formats may only provide values for one channel where R, G, B are the same. Even in that case, you should provide three equal values to the setter.

validate() None

Will throw if data is not valid.

Lut3DTransform

class PyOpenColorIO.Lut3DTransform

Represents a 3D-LUT transform.

Lut3DTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.Lut3DTransform) -> None

Create an identity 3D-LUT of size 2x2x2.

  1. __init__(self: PyOpenColorIO.Lut3DTransform, gridSize: int) -> None

Create an identity 3D-LUT with specific grid size. Will throw for grid size larger than 129.

  1. __init__(self: PyOpenColorIO.Lut3DTransform, gridSize: int = 2, fileOutputBitDepth: PyOpenColorIO.BitDepth = <BitDepth.BIT_DEPTH_UNKNOWN: 0>, interpolation: PyOpenColorIO.Interpolation = <Interpolation.INTERP_DEFAULT: 254>, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

Create an identity 3D-LUT with specific grid size. Will throw for grid size larger than 129.

equals(other: PyOpenColorIO.Lut3DTransform) bool

Checks if this exactly equals other.

getData() numpy.ndarray
getDirection() PyOpenColorIO.TransformDirection
getFileOutputBitDepth() PyOpenColorIO.BitDepth
getFormatMetadata() PyOpenColorIO.FormatMetadata
getGridSize() int
getInterpolation() PyOpenColorIO.Interpolation
getTransformType() PyOpenColorIO.TransformType
getValue(indexR: int, indexG: int, indexB: int) tuple
setData(data: buffer) None
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setFileOutputBitDepth(bitDepth: PyOpenColorIO.BitDepth) None

Get the bit-depth associated with the LUT values read from a file or set the bit-depth of values to be written to a file (for file formats such as CLF that support multiple bit-depths). However, note that the values stored in the object are always normalized.

setGridSize(gridSize: int) None

Changing the grid size will reset the LUT to identity. Will throw for grid sizes larger than 129.

setInterpolation(interpolation: PyOpenColorIO.Interpolation) None
setValue(indexR: int, indexG: int, indexB: int, r: float, g: float, b: float) None

Set the values of a 3D-LUT. Will throw if an index is outside of the range from 0 to (gridSize-1).

The LUT values are always for the “forward” LUT, regardless of how the transform direction is set.

These values are normalized relative to what may be stored in any given LUT files. For example in a CLF file using a “10i” output depth, a value of 1023 in the file is normalized to 1.0. The values here are unclamped and may extend outside [0,1].

validate() None

Will throw if data is not valid.

MatrixTransform

class PyOpenColorIO.MatrixTransform

Represents an MX+B Matrix transform.

Note

For singular matrices, an inverse direction will throw an exception during finalization.

static Fit(oldMin: List[float[4]] = [0.0, 0.0, 0.0, 0.0], oldMax: List[float[4]] = [1.0, 1.0, 1.0, 1.0], newMin: List[float[4]] = [0.0, 0.0, 0.0, 0.0], newMax: List[float[4]] = [1.0, 1.0, 1.0, 1.0]) PyOpenColorIO.MatrixTransform

Convenience functions

Build the matrix and offset corresponding to higher-level concepts.

Note

These can throw an exception if for any component oldmin == oldmax. (divide by 0)

static Identity() PyOpenColorIO.MatrixTransform
static Sat(sat: float, lumaCoef: List[float[3]]) PyOpenColorIO.MatrixTransform
static Scale(scale: List[float[4]]) PyOpenColorIO.MatrixTransform
static View(channelHot: List[int[4]], lumaCoef: List[float[3]]) PyOpenColorIO.MatrixTransform
MatrixTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.MatrixTransform) -> None

  2. __init__(self: PyOpenColorIO.MatrixTransform, matrix: List[float[16]] = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0], offset: List[float[4]] = [0.0, 0.0, 0.0, 0.0], direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

equals(other: PyOpenColorIO.MatrixTransform) bool

Checks if this exactly equals other.

getDirection() PyOpenColorIO.TransformDirection
getFileInputBitDepth() PyOpenColorIO.BitDepth

Get the bit-depths associated with the matrix values read from a file or set the bit-depths of values to be written to a file (for file formats such as CLF that support multiple bit-depths).

In a format such as CLF, the matrix values are scaled to take pixels at the specified inBitDepth to pixels at the specified outBitDepth. This complicates the interpretation of the matrix values and so this object always holds normalized values and scaling is done on the way from or to file formats such as CLF.

getFileOutputBitDepth() PyOpenColorIO.BitDepth
getFormatMetadata() PyOpenColorIO.FormatMetadata
getMatrix() List[float[16]]
getOffset() List[float[4]]
getTransformType() PyOpenColorIO.TransformType
setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setFileInputBitDepth(bitDepth: PyOpenColorIO.BitDepth) None
setFileOutputBitDepth(bitDepth: PyOpenColorIO.BitDepth) None
setMatrix(matrix: List[float[16]]) None

Get or set the values of a Matrix. Expects 16 values, where the first four are the coefficients to generate the R output channel from R, G, B, A input channels.

The Matrix values are always for the “forward” Matrix, regardless of how the transform direction is set.

These values are normalized relative to what may be stored in file formats such as CLF. For example in a CLF file using a “32f” input depth and “10i” output depth, a value of 1023 in the file is normalized to 1.0. The values here are unclamped and may extend outside [0,1].

setOffset(offset: List[float[4]]) None

Get or set the R, G, B, A offsets to be applied after the matrix.

These values are normalized relative to what may be stored in file formats such as CLF. For example, in a CLF file using a “10i” output depth, a value of 1023 in the file is normalized to 1.0. The values here are unclamped and may extend outside [0,1].

validate() None

Will throw if data is not valid.

RangeTransform

class PyOpenColorIO.RangeTransform

Represents a range transform

The Range is used to apply an affine transform (scale & offset) and clamps values to min/max bounds on all color components except the alpha. The scale and offset values are computed from the input and output bounds.

Refer to section 7.2.4 in specification S-2014-006 “A Common File Format for Look-Up Tables” from the Academy of Motion Picture Arts and Sciences and the American Society of Cinematographers.

Note

The “noClamp” style described in the specification S-2014-006 becomes a MatrixOp at the processor level.

Note

Changing the transform direction does not modify the in/out values – they are always specified with respect to the “forward” direction.

RangeTransform(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.RangeTransform) -> None

Creates an instance of RangeTransform.

  1. __init__(self: PyOpenColorIO.RangeTransform, minInValue: float = nan, maxInValue: float = nan, minOutValue: float = nan, maxOutValue: float = nan, direction: PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) -> None

Creates an instance of RangeTransform.

equals(other: PyOpenColorIO.RangeTransform) bool

Checks if this equals other.

getDirection() PyOpenColorIO.TransformDirection
getFileInputBitDepth() PyOpenColorIO.BitDepth

File bit-depth

In a format such as CLF, the range values are scaled to take pixels at the specified inBitDepth to pixels at the specified outBitDepth. This complicates the interpretation of the range values and so this object always holds normalized values and scaling is done on the way from or to file formats such as CLF. Get the bit-depths associated with the range values read from a file or set the bit-depths of values to be written to a file (for file formats such as CLF that support multiple bit-depths).

getFileOutputBitDepth() PyOpenColorIO.BitDepth
getFormatMetadata() PyOpenColorIO.FormatMetadata
getMaxInValue() float

Get the maximum value for the input.

getMaxOutValue() float

Get the maximum value for the output.

getMinInValue() float

Get the minimum value for the input.

Range values

These values are normalized relative to what may be stored in file formats such as CLF. For example in a CLF file using a “10i” input depth, a MaxInValue of 1023 in the file is normalized to 1.0. Likewise, for an output depth of “12i”, a MaxOutValue of 4095 in the file is normalized to 1.0. The values here are unclamped and may extend outside [0,1].

getMinOutValue() float

Get the minimum value for the output.

getStyle() PyOpenColorIO.RangeStyle
getTransformType() PyOpenColorIO.TransformType
hasMaxInValue() bool

Is the maximum value for the input set?

hasMaxOutValue() bool

Is the maximum value for the output set?

hasMinInValue() bool

Is the minimum value for the input set?

hasMinOutValue() bool

Is the minimum value for the output set?

setDirection(direction: PyOpenColorIO.TransformDirection) None

Note that this only affects the evaluation and not the values stored in the object.

setFileInputBitDepth(bitDepth: PyOpenColorIO.BitDepth) None
setFileOutputBitDepth(bitDepth: PyOpenColorIO.BitDepth) None
setMaxInValue(value: float) None

Set the maximum value for the input.

setMaxOutValue(value: float) None

Set the maximum value for the output.

setMinInValue(value: float) None

Set the minimum value for the input.

setMinOutValue(value: float) None

Set the minimum value for the output.

setStyle(style: PyOpenColorIO.RangeStyle) None

Set the Range style to clamp or not input values.

unsetMaxInValue() None

Unset the maximum value for the input.

unsetMaxOutValue() None

Unset the maximum value for the output.

unsetMinInValue() None

Unset the minimum value for the input.

unsetMinOutValue() None

Unset the minimum value for the output.

validate() None

Will throw if data is not valid.