colour.write_image¶
- colour.write_image(image, path, bit_depth='float32', method='OpenImageIO', **kwargs)[source]¶
Writes given image at given path using given method.
- Parameters
image (array_like) – Image data.
path (unicode) – Image path.
bit_depth (unicode, optional) – {‘float32’, ‘uint8’, ‘uint16’, ‘float16’}, Bit depth to write the image at, for the Imageio method, the image data is converted with
colour.io.convert_bit_depth()
definition prior to writing the image.method (unicode, optional) – {‘OpenImageIO’, ‘Imageio’}, Write method, i.e. the image library used for writing images.
attributes (array_like, optional) – {
colour.io.write_image_OpenImageIO()
}, An array ofcolour.io.ImageAttribute_Specification
class instances used to set attributes of the image.
- Returns
Definition success.
- Return type
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