colour.write_image

colour.write_image(image, path, bit_depth='float32', attributes=None)[source]

Writes given image using OpenImageIO.

Parameters:
  • image (array_like) – Image data.
  • path (unicode) – Image path.
  • bit_depth (unicode, optional) – {‘float32’, ‘uint8’, ‘uint16’, ‘float16’}, Image bit_depth.
  • attributes (array_like, optional) – An array of colour.io.ImageAttribute_Specification class instances used to set attributes of the image.
Returns:

Definition success.

Return type:

bool

Examples

Basic image writing:

>>> import os
>>> path = os.path.join('tests', 'resources', 'CMSTestPattern.exr')
>>> image = read_image(path)  # doctest: +SKIP
>>> path = os.path.join('tests', 'resources', 'CMSTestPattern.tif')
>>> write_image(image, path)  # doctest: +SKIP
True

Advanced image writing while setting attributes:

>>> compression = ImageAttribute_Specification('Compression', 'none')
>>> write_image(image, path, 'uint8', [compression])  # doctest: +SKIP
True