colour.io.process_image_OpenColorIO#

colour.io.process_image_OpenColorIO(a: ArrayLike, *args: Any, **kwargs: Any) NDArrayFloat[source]#

Process given image data with OpenColorIO.

Parameters:
  • a (ArrayLike) – Image data to process with OpenColorIO.

  • configOpenColorIO config to use for processing. If not defined, the OpenColorIO set defined by the $OCIO environment variable is used.

  • args (Any) – Arguments for Config.getProcessor method. See https://opencolorio.readthedocs.io/en/latest/api/config.html for more information.

  • kwargs (Any)

Returns:

Processed image data.

Return type:

numpy.ndarray

Examples

>>> import os
>>> import PyOpenColorIO as ocio  
>>> from colour.utilities import full
>>> config = os.path.join(
...     os.path.dirname(__file__),
...     "tests",
...     "resources",
...     "config-aces-reference.ocio.yaml",
... )
>>> a = 0.18
>>> process_image_OpenColorIO(  
...     a, "ACES - ACES2065-1", "ACES - ACEScct", config=config
... )
0.4135884...
>>> a = np.array([0.18])
>>> process_image_OpenColorIO(  
...     a, "ACES - ACES2065-1", "ACES - ACEScct", config=config
... )
array([ 0.4135884...])
>>> a = np.array([0.18, 0.18, 0.18])
>>> process_image_OpenColorIO(  
...     a, "ACES - ACES2065-1", "ACES - ACEScct", config=config
... )
array([ 0.4135884...,  0.4135884...,  0.4135884...])
>>> a = np.array([[0.18, 0.18, 0.18]])
>>> process_image_OpenColorIO(  
...     a, "ACES - ACES2065-1", "ACES - ACEScct", config=config
... )
array([[ 0.4135884...,  0.4135884...,  0.4135884...]])
>>> a = np.array([[[0.18, 0.18, 0.18]]])
>>> process_image_OpenColorIO(  
...     a, "ACES - ACES2065-1", "ACES - ACEScct", config=config
... )
array([[[ 0.4135884...,  0.4135884...,  0.4135884...]]])
>>> a = full([4, 2, 3], 0.18)
>>> process_image_OpenColorIO(  
...     a, "ACES - ACES2065-1", "ACES - ACEScct", config=config
... )
array([[[ 0.4135884...,  0.4135884...,  0.4135884...],
        [ 0.4135884...,  0.4135884...,  0.4135884...]],

       [[ 0.4135884...,  0.4135884...,  0.4135884...],
        [ 0.4135884...,  0.4135884...,  0.4135884...]],

       [[ 0.4135884...,  0.4135884...,  0.4135884...],
        [ 0.4135884...,  0.4135884...,  0.4135884...]],

       [[ 0.4135884...,  0.4135884...,  0.4135884...],
        [ 0.4135884...,  0.4135884...,  0.4135884...]]])
>>> process_image_OpenColorIO(  
...     a,
...     "ACES - ACES2065-1",
...     "Display - sRGB",
...     "Output - SDR Video - ACES 1.0",
...     ocio.TRANSFORM_DIR_FORWARD,
...     config=config,
... )
array([[[ 0.3559542...,  0.3559542...,  0.3559542...],
        [ 0.3559542...,  0.3559542...,  0.3559542...]],

       [[ 0.3559542...,  0.3559542...,  0.3559542...],
        [ 0.3559542...,  0.3559542...,  0.3559542...]],

       [[ 0.3559542...,  0.3559542...,  0.3559542...],
        [ 0.3559542...,  0.3559542...,  0.3559542...]],

       [[ 0.3559542...,  0.3559542...,  0.3559542...],
        [ 0.3559542...,  0.3559542...,  0.3559542...]]])