colour.write_image

colour.write_image(image: ArrayLike, path: str, bit_depth: Literal['uint8', 'uint16', 'float16', 'float32', 'float64', 'float128'] = 'float32', method: Union[Literal['Imageio', 'OpenImageIO'], str] = 'OpenImageIO', **kwargs: Any) bool[source]

Write given image at given path using given method.

Parameters
Returns

Definition success.

Return type

bool

Notes

  • If the given method is OpenImageIO but the library is not available writing will be performed by Imageio.

  • If the given method is Imageio, kwargs is passed directly to the wrapped definition.

Examples

Basic image writing:

>>> 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(image, path)  
True

Advanced image writing while setting attributes using OpenImageIO:

>>> compression = ImageAttribute_Specification('Compression', 'none')
>>> write_image(image, path, bit_depth='uint8', attributes=[compression])
... 
True