# OpenColorIO

## Open Source Color Management

# Python Transforms

## Transform

class `PyOpenColorIO.``Transform`

  These are typically only needed when creating or manipulating configurations.

  `createEditableCopy`
  `getDirection`
  `isEditable`
  `setDirection`

## AllocationTransform

    import PyOpenColorIO as OCIO
    transform = OCIO.AllocationTransform()
    transform.setAllocation(OCIO.Constants.ALLOCATION)

class `PyOpenColorIO.``AllocationTransform`

  Respans the ‘expanded’ range into the specified (often compressed) range.

  Performs both squeeze (offset) and log transforms.

  `createEditableCopy`
  `getAllocation`

    getAllocation()

    Returns the allocation specified in the transform. Allocation is an enum, defined in Constants.

    Returns: | Allocation
    Return type: | string

  `getDirection`
  `getVars`

    getVars()

    Returns the allocation values specified in the transform.

    Returns: | allocation values
    Return type: | list of floats

  `isEditable`
  `setAllocation`

    setAllocation(hwalloc)

    Sets the allocation of the transform.

    Parameters:

    - hwalloc (object) – Allocation

  `setDirection`
  `setVars`

    setVars(pyvars)

    Sets the allocation in the transform.

    Parameters:

    - pyvars (object) – list of floats

## CDLTransform

    import PyOpenColorIO as OCIO

    cdl = OCIO.CDLTransform()
    # Set the slope, offset, power, and saturation for each channel.
    cdl.setSOP([, , , , , , , , ])
    cdl.setSat([, , ])
    cdl.getSatLumaCoefs()

class `PyOpenColorIO.``CDLTransform`

  CDLTransform

  `createEditableCopy`
  `equals`
  `getDescription`

    getDescription()

    Returns the description of `PyOpenColorIO.CDLTransform`.

    Returns: | description
    Return type: | string

  `getDirection`
  `getID`

    getID()

    Returns the ID from `PyOpenColorIO.CDLTransform`.

    Returns: | ID
    Return type: | string

  `getOffset`
  `getPower`
  `getSOP`
  `getSat`
  `getSatLumaCoefs`

    getSatLumaCoefs(pyData)

    Returns the SAT (saturation) and luma coefficients in `CDLTransform`.

    Returns: | saturation and luma coefficients
    Return type: | list of floats

  `getSlope`
  `getXML`
  `isEditable`
  `setDescription`

    setDescription(str)

    Sets the description of `PyOpenColorIO.CDLTransform`.

    Parameters:

    - str (string) – description

  `setDirection`
  `setID`

    setID(str)

    Sets the ID in `PyOpenColorIO.CDLTransform`.

    Parameters:

    - str (string) – ID

  `setOffset`

    setOffset(pyData)

    Sets the offset (‘O’ part of SOP) in `PyOpenColorIO.CDLTransform`.

    Parameters:

    - pyData (object) – list of three floats

  `setPower`

    setPower(pyData)

    Sets the power (‘P’ part of SOP) in `PyOpenColorIO.CDLTransform`.

    Parameters:

    - pyData (object) – list of three floats

  `setSOP`

    setSOP(pyData)

    Sets SOP in `PyOpenColorIO.CDLTransform`.

    Parameters:

    - pyData (object) – list of nine floats

  `setSat`

    setSAT(pyData)

    Sets SAT (saturation) in `PyOpenColorIO.CDLTransform`.

    Parameters:

    - pyData (float) – saturation

  `setSlope`

    setSlope(pyData)

    Sets the slope (‘S’ part of SOP) in `PyOpenColorIO.CDLTransform`.

    Parameters:

    - pyData (object) –

  `setXML`

## ColorSpaceTransform

This class is meant so that ColorSpace conversions can be reused, referencing ColorSpaces that already exist.

Note

Careless use of this may create infinite loops, so avoid referencing the colorspace you’re in.

    import PyOpenColorIO as OCIO
    transform = OCIO.ColorSpaceTransform()

class `PyOpenColorIO.``ColorSpaceTransform`

  ColorSpaceTransform

  `createEditableCopy`
  `getDirection`
  `getDst`

    getDst()

    Returns the name of the destination ColorSpace in this transform.

    Returns: | ColorSpace
    Return type: | string

  `getSrc`

    getSrc()

    Returns the name of the source ColorSpace in this transform.

    Returns: | ColorSpace
    Return type: | string

  `isEditable`
  `setDirection`
  `setDst`

    setDst(dstname)

    Sets the destination ColorSpace in this transform.

    Parameters:

    - str (string) – destination ColorSpace

  `setSrc`

    setSrc(srcname)

    Sets the source ColorSpace in this transform.

    Parameters:

    - str (string) – source ColorSpace

## DisplayTransform

    import PyOpenColorIO as OCIO
    transform = OCIO.DisplayTransform()

class `PyOpenColorIO.``DisplayTransform`

  Used to create transforms for displays.

  `createEditableCopy`
  `getChannelView`

    getChannelView()

    Returns the channel view of `PyOpenColorIO.DisplayTransform`.

    Returns: | channel view
    Return type: | object

  `getColorTimingCC`

    getColorTimingCC()

    Returns the color timing CC transform of `PyOpenColorIO.DisplayTransform`.

    Returns: | color timing CC transform
    Return type: | object

  `getDirection`
  `getDisplay`

    getDisplay()

    Returns the display of `PyOpenColorIO.DisplayTransform`.

    Returns: | display
    Return type: | string

  `getDisplayCC`

    getDisplayCC()

    Returns the display CC transform of `PyOpenColorIO.DisplayTransform`.

    Returns: | display CC
    Return type: | object

  `getInputColorSpaceName`

    getInputColorSpaceName()

    Returns the name of the input ColorSpace of `PyOpenColorIO.DisplayTransform`.

    Returns: | name of input ColorSpace
    Return type: | string

  `getLinearCC`

    getLinearCC()

    Returns the linear CC transform of `PyOpenColorIO.DisplayTransform`.

    Returns: | linear CC transform
    Return type: | object

  `getLooksOverride`

    getLooksOverride()

    Returns the looks in `PyOpenColorIO.DisplayTransform` that’s overriding `PyOpenColorIO.Config`‘s.

    Returns: | looks override
    Return type: | string

  `getLooksOverrideEnabled`

    getLooksOverrideEnabled()

    Returns whether the looks override of `PyOpenColorIO.DisplayTransform` is enabled.

    Returns: | looks override enabling
    Return type: | bool

  `getView`

    getView()

    Returns the view of `PyOpenColorIO.DisplayTransform`.

    Returns: | view
    Return type: | string

  `isEditable`
  `setChannelView`

    setChannelView(pyCC)

    Sets the channel view transform of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - pyCC (object) – channel view transform

  `setColorTimingCC`

    setColorTimingCC(pyCC)

    Sets the color timing CC transform of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - pyCC (object) – color timing CC

  `setDirection`
  `setDisplay`

    setDisplay(str)

    Sets the display of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - str (string) – display

  `setDisplayCC`

    setDisplayCC(pyCC)

    Sets the display CC transform of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - pyCC (object) – display CC

  `setInputColorSpaceName`

    setInputColorSpaceName(name)

    Sets the name of the input ColorSpace of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - name (string) – name of input ColorSpace

  `setLinearCC`

    setLinearCC(pyCC)

    Sets the linear CC transform of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - pyCC (object) – linear CC

  `setLooksOverride`

    setLooksOverride(str)

    Sets the looks override of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - str (string) – looks override

  `setLooksOverrideEnabled`

    setLooksOverrideEnabled(enabled)

    Sets the looks override enabling of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - enabled (object) – looks override enabling

  `setView`

    setView(str)

    Sets the view of `PyOpenColorIO.DisplayTransform`.

    Parameters:

    - str (string) – view

## ExponentTransform

    import PyOpenColorIO as OCIO
    transform = OCIO.ExponentTransform()

class `PyOpenColorIO.``ExponentTransform`

  ExponentTransform

  `createEditableCopy`
  `getDirection`
  `getValue`

    getValue()

    Returns the values in the exponent transform of `PyOpenColorIO.ExponentTransform`.

    Returns: | exponent transform values
    Return type: | list of floats

  `isEditable`
  `setDirection`
  `setValue`

    setValue()

    Sets the values in the exponent transform of `PyOpenColorIO.ExponentTransform`.

    Parameters:

    - pyData (list of 4 floats) – exponent transform values

## FileTransform

class `PyOpenColorIO.``FileTransform`

  FileTransform

  `createEditableCopy`
  `getCCCId`
  `getDirection`
  `getInterpolation`
  `getSrc`
  `isEditable`
  `setCCCId`
  `setDirection`
  `setInterpolation`
  `setSrc`

## GroupTransform

class `PyOpenColorIO.``GroupTransform`

  GroupTransform

  `clear`
  `createEditableCopy`
  `empty`
  `getDirection`
  `getTransform`
  `getTransforms`
  `isEditable`
  `push_back`
  `setDirection`
  `setTransforms`
  `size`

## LogTransform

    import PyOpenColorIO as OCIO

`LogTransform` is used to define a log transform. The direction of the transform and its numerical base can be specified.

class `PyOpenColorIO.``LogTransform`

  LogTransform

  `createEditableCopy`
  `getBase`

    getBase()

    Returns the base of `PyOpenColorIO.LogTransform`.

  `getDirection`
  `isEditable`
  `setBase`

    setBase(base)

    Sets the base in `PyOpenColorIO.LogTransform`.

    Parameters:

    - base (float) – base of log transform

  `setDirection`

## LookTransform

class `PyOpenColorIO.``LookTransform`

  LookTransform

  `createEditableCopy`
  `getDirection`
  `getDst`
  `getLooks`
  `getSrc`
  `isEditable`
  `setDirection`
  `setDst`
  `setLooks`
  `setSrc`

## MatrixTransform

class `PyOpenColorIO.``MatrixTransform`

  MatrixTransfom

  static `Fit`()
  static `Identity`()
  static `Sat`()
  static `Scale`()
  static `View`()
  `createEditableCopy`
  `getDirection`
  `getMatrix`
  `getOffset`
  `getValue`
  `isEditable`
  `setDirection`
  `setMatrix`
  `setOffset`
  `setValue`