colour.io.process_image_OpenColorIO

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

Process given image with OpenColorIO.

Parameters
  • a (ArrayLike) – Image 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.

Return type

numpy.ndarray

Examples

# TODO: Reinstate when “Pypi” wheel compatible with “ARM” on “macOS” is # released.

>>> 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 = full([4, 2, 3], 0.18)
>>> process_image_OpenColorIO(  
...     a, 'ACES - ACES2065-1', 'ACES - ACEScct', config=config)
array([[[ 0.4135878...,  0.4135878...,  0.4135878...],
        [ 0.4135878...,  0.4135878...,  0.4135878...]],

       [[ 0.4135878...,  0.4135878...,  0.4135878...],
        [ 0.4135878...,  0.4135878...,  0.4135878...]],

       [[ 0.4135878...,  0.4135878...,  0.4135878...],
        [ 0.4135878...,  0.4135878...,  0.4135878...]],

       [[ 0.4135878...,  0.4135878...,  0.4135878...],
        [ 0.4135878...,  0.4135878...,  0.4135878...]]], dtype=float32)
>>> process_image_OpenColorIO(  
...     a, 'ACES - ACES2065-1', 'Display - sRGB',
...     'Output - SDR Video - ACES 1.0', ocio.TRANSFORM_DIR_FORWARD,
...     config=config)
array([[[ 0.3559523...,  0.3559525...,  0.3559525...],
        [ 0.3559523...,  0.3559525...,  0.3559525...]],

       [[ 0.3559523...,  0.3559525...,  0.3559525...],
        [ 0.3559523...,  0.3559525...,  0.3559525...]],

       [[ 0.3559523...,  0.3559525...,  0.3559525...],
        [ 0.3559523...,  0.3559525...,  0.3559525...]],

       [[ 0.3559523...,  0.3559525...,  0.3559525...],
        [ 0.3559523...,  0.3559525...,  0.3559525...]]], dtype=float32)