colour.io.read_image_OpenImageIO#

colour.io.read_image_OpenImageIO(path: str | PathLike, bit_depth: Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128'] = 'float32', additional_data: Literal[True] = True, **kwargs: Any) Tuple[NDArrayReal, Tuple[Image_Specification_Attribute, ...]][source]#
colour.io.read_image_OpenImageIO(path: str | PathLike, bit_depth: Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128'] = 'float32', *, additional_data: Literal[False], **kwargs: Any) NDArrayReal
colour.io.read_image_OpenImageIO(path: str | PathLike, bit_depth: Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128'], additional_data: Literal[False], **kwargs: Any) NDArrayReal

Read image data from the specified path using OpenImageIO.

Load image data from the file system with support for various bit-depth formats. The bit-depth conversion behaviour is controlled by OpenImageIO, with this function performing only the final type conversion after reading.

Parameters:
  • path (str | PathLike) – Path to the image file.

  • bit_depth (Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128']) – Target bit-depth for the returned image data. The bit-depth conversion is handled by OpenImageIO during the read operation, with this function converting to the appropriate NumPy data type afterwards.

  • additional_data (bool) – Whether to return additional metadata from the image file.

  • kwargs (Any)

Returns:

Image data as an array when additional_data is False, or a tuple containing the image data and a tuple of colour.io.Image_Specification_Attribute instances when additional_data is True.

Return type:

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)