colour.io.read_image_OpenImageIO#

colour.io.read_image_OpenImageIO(path: str | Path, bit_depth: Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128'] = 'float32', attributes: bool = False) NDArrayReal | Tuple[NDArrayReal, list][source]#

Read the image data at given path using OpenImageIO.

Parameters:
  • path (str | Path) – Image path.

  • bit_depth (Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128']) – Returned image bit-depth, the bit-depth conversion behaviour is driven directly by OpenImageIO, this definition only converts to the relevant data type after reading.

  • attributes (bool) – Whether to return the image attributes.

Returns:

Image data or tuple of image data and list of colour.io.ImageAttribute_Specification class instances.

Return type:

class`numpy.ndarray` or tuple

Notes

  • For convenience, single channel images are squeezed to 2D arrays.

Examples

>>> import os
>>> import colour
>>> path = os.path.join(
...     colour.__path__[0],
...     "io",
...     "tests",
...     "resources",
...     "CMS_Test_Pattern.exr",
... )
>>> image = read_image_OpenImageIO(path)