colour.io.write_image_Imageio#

colour.io.write_image_Imageio(image: ArrayLike, path: str | PathLike, bit_depth: Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128'] = 'float32', **kwargs: Any) bytes | None[source]#

Write image data to the specified path using Imageio.

Parameters:
  • image (ArrayLike) – Image data to write.

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

  • bit_depth (Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128']) – Bit-depth to write the image at. The image data is converted with colour.io.convert_bit_depth() definition prior to writing.

  • kwargs (Any) – Keywords arguments passed to the underlying Imageio imwrite function.

Returns:

Image data written as bytes if successful, None otherwise.

Return type:

bytes or None

Notes

Examples

>>> import os
>>> import colour
>>> path = os.path.join(
...     colour.__path__[0],
...     "io",
...     "tests",
...     "resources",
...     "CMS_Test_Pattern.exr",
... )
>>> image = read_image(path)
>>> path = os.path.join(
...     colour.__path__[0],
...     "io",
...     "tests",
...     "resources",
...     "CMSTestPattern.tif",
... )
>>> write_image_Imageio(image, path)
True