ColorSpace

class PyOpenColorIO.ColorSpace

The :ref:`ColorSpace` is the state of an image with respect to colorimetry and color encoding. Transforming images between different ColorSpaces is the primary motivation for this library.

While a complete discussion of color spaces is beyond the scope of header documentation, traditional uses would be to have ColorSpaces corresponding to: physical capture devices (known cameras, scanners), and internal ‘convenience’ spaces (such as scene linear, logarithmic).

ColorSpace(*args, **kwargs)

Overloaded function.

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

  2. __init__(self: PyOpenColorIO.ColorSpace, referenceSpace: PyOpenColorIO.ReferenceSpaceType) -> None

  3. __init__(self: PyOpenColorIO.ColorSpace, referenceSpace: PyOpenColorIO.ReferenceSpaceType = <ReferenceSpaceType.REFERENCE_SPACE_SCENE: 0>, name: str = ‘’, aliases: List[str] = [], family: str = ‘’, encoding: str = ‘’, equalityGroup: str = ‘’, description: str = ‘’, bitDepth: PyOpenColorIO.BitDepth = <BitDepth.BIT_DEPTH_UNKNOWN: 0>, isData: bool = False, allocation: PyOpenColorIO.Allocation = <Allocation.ALLOCATION_UNIFORM: 1>, allocationVars: List[float] = [], toReference: PyOpenColorIO.Transform = None, fromReference: PyOpenColorIO.Transform = None, categories: List[str] = []) -> None

addAlias(alias: str) None

Add an alias for the color space name (the aliases may be used as a synonym for the name). Nothing will be added if the alias is already the color space name, one of its aliases, or the argument is null. The aliases must not conflict with existing roles, color space names, named transform names, or other aliases. This is verified when adding the color space to the config.

addCategory(category: str) None

Add a single category.

Note

Will do nothing if the category already exists.

clearAliases() None
clearCategories() None

Clear all the categories.

getAliases() PyOpenColorIO.ColorSpace.ColorSpaceAliasIterator
getAllocation() PyOpenColorIO.Allocation

Allocation

If this colorspace needs to be transferred to a limited dynamic range coding space (such as during display with a GPU path), use this allocation to maximize bit efficiency.

getAllocationVars() List[float]
getBitDepth() PyOpenColorIO.BitDepth
getCategories() PyOpenColorIO.ColorSpace.ColorSpaceCategoryIterator
getDescription() str
getEncoding() str

Encodings

It is sometimes useful for applications to group color spaces based on how the color values are digitally encoded. For example, images in scene-linear, logarithmic, video, and data color spaces could have different default views. Unlike the Family and EqualityGroup attributes of a color space, the list of Encodings is predefined in the OCIO documentation (rather than being config-specific) to make it easier for applications to utilize.

Here is an example config entry that could appear under a ColorSpace:

encoding: scene-linear

Encoding strings are not case-sensitive. Although users may add their own encodings, the strings will typically come from a fixed set listed in the documentation (similar to roles).

getEqualityGroup() str

Get the ColorSpace group name (used for equality comparisons) This allows no-op transforms between different colorspaces. If an equalityGroup is not defined (an empty string), it will be considered unique (i.e., it will not compare as equal to other ColorSpaces with an empty equality group).

getFamily() str

Get the family, for use in user interfaces (optional) The family string could use a ‘/’ separator to indicate levels to be used by hierarchical menus.

getName() str
getReferenceSpaceType() PyOpenColorIO.ReferenceSpaceType

A display color space will use the display-referred reference space.

getTransform(direction: PyOpenColorIO.ColorSpaceDirection) PyOpenColorIO.Transform

:ref:`Transform`

If a transform in the specified direction has been specified, return it. Otherwise return a null ConstTransformRcPtr

hasCategory(category: str) bool

Return true if the category is present.

A category is used to allow applications to filter the list of color spaces they display in menus based on what that color space is used for.

Here is an example config entry that could appear under a ColorSpace:

categories: [ file-io, working-space, basic-3d ]

The example contains three categories: ‘file-io’, ‘working-space’ and ‘basic-3d’.

Note

Category strings are not case-sensitive and the order is not significant.

There is no limit imposed on length or number. Although users may add their own categories, the strings will typically come from a fixed set listed in the documentation (similar to roles).

isData() bool

Data

ColorSpaces that are data are treated a bit special. Basically, any colorspace transforms you try to apply to them are ignored. (Think of applying a gamut mapping transform to an ID pass). However, the setDataBypass method on ColorSpaceTransform and DisplayViewTransform allow applications to process data when necessary. (Think of sending mattes to an HDR monitor.)

This is traditionally used for pixel data that represents non-color pixel data, such as normals, point positions, ID information, etc.

removeAlias(alias: str) None

Does nothing if alias is not present.

removeCategory(category: str) None

Remove a category.

Note

Will do nothing if the category is missing.

setAllocation(allocation: PyOpenColorIO.Allocation) None
setAllocationVars(vars: List[float]) None
setBitDepth(bitDepth: PyOpenColorIO.BitDepth) None
setDescription(description: str) None
setEncoding(encoding: str) None
setEqualityGroup(equalityGroup: str) None
setFamily(family: str) None

Set the family, for use in user interfaces (optional)

setIsData(isData: bool) None
setName(name: str) None

If the name is already an alias, that alias is removed.

setTransform(transform: PyOpenColorIO.Transform, direction: PyOpenColorIO.ColorSpaceDirection) None

Specify the transform for the appropriate direction. Setting the transform to null will clear it.

class PyOpenColorIO.ColorSpace.ColorSpaceCategoryIterator
self[arg0: int] str
iter(self) PyOpenColorIO.ColorSpace.ColorSpaceCategoryIterator
len(self) int
next(self) str
class PyOpenColorIO.ColorSpace.ColorSpaceAliasIterator
self[arg0: int] str
iter(self) PyOpenColorIO.ColorSpace.ColorSpaceAliasIterator
len(self) int
next(self) str

ColorSpaceSet

class PyOpenColorIO.ColorSpaceSet

The :ref:`ColorSpaceSet` is a set of color spaces (i.e. no color space duplication) which could be the result of Config::getColorSpaces or built from scratch.

Note

The color spaces are decoupled from the config ones, i.e., any changes to the set itself or to its color spaces do not affect the original color spaces from the configuration. If needed, use Config::addColorSpace to update the configuration.

self & arg0: PyOpenColorIO.ColorSpaceSet PyOpenColorIO.ColorSpaceSet

Perform the intersection of two sets.

Note

This function provides operations on two color space sets where the result contains copied color spaces and no duplicates.

Parameters:
  • lcss

  • rcss

self == arg0: PyOpenColorIO.ColorSpaceSet bool

Return true if the two sets are equal.

Note

The comparison is done on the color space names (not a deep comparison).

ColorSpaceSet() None

Create an empty set of color spaces.

self != arg0: PyOpenColorIO.ColorSpaceSet bool

Return true if the two sets are different.

self | arg0: PyOpenColorIO.ColorSpaceSet PyOpenColorIO.ColorSpaceSet

Perform the union of two sets.

Note

This function provides operations on two color space sets where the result contains copied color spaces and no duplicates.

Parameters:
  • lcss

  • rcss

self - arg0: PyOpenColorIO.ColorSpaceSet PyOpenColorIO.ColorSpaceSet

Perform the difference of two sets.

Note

This function provides operations on two color space sets where the result contains copied color spaces and no duplicates.

Parameters:
  • lcss

  • rcss

addColorSpace(colorSpace: PyOpenColorIO.ColorSpace) None

Add color space(s).

Note

If another color space is already registered with the same name, this will overwrite it. This stores a copy of the specified color space(s). Throws if one of the aliases is already assigned as a name or alias to an existing color space.

addColorSpaces(colorSpaces: PyOpenColorIO.ColorSpaceSet) None
clearColorSpaces() None

Clear all color spaces.

getColorSpace(name: str) PyOpenColorIO.ColorSpace

Note

Only accepts color space names (i.e. no role name).

Will return null if the name is not found.

getColorSpaceNames() PyOpenColorIO.ColorSpaceSet.ColorSpaceNameIterator
getColorSpaces() PyOpenColorIO.ColorSpaceSet.ColorSpaceIterator
removeColorSpace(colorSpace: str) None

Remove color space(s) using color space names (i.e. no role name).

Note

The removal of a missing color space does nothing.

removeColorSpaces(colorSpaces: PyOpenColorIO.ColorSpaceSet) None
class PyOpenColorIO.ColorSpaceSet.ColorSpaceNameIterator
self[arg0: int] str
iter(self) PyOpenColorIO.ColorSpaceSet.ColorSpaceNameIterator
len(self) int
next(self) str
class PyOpenColorIO.ColorSpaceSet.ColorSpaceIterator
self[arg0: int] PyOpenColorIO.ColorSpace
iter(self) PyOpenColorIO.ColorSpaceSet.ColorSpaceIterator
len(self) int
next(self) PyOpenColorIO.ColorSpace