colour.io.image Module¶
Image Input / Output Utilities¶
Defines image related input / output utilities objects.
-
class
colour.io.image.
BitDepth_Specification
(name, numpy, openimageio, domain, clip)¶ Bases:
tuple
-
__getnewargs__
()¶ Return self as a plain tuple. Used by copy and pickle.
-
__getstate__
()¶ Exclude the OrderedDict from pickling
-
__repr__
()¶ Return a nicely formatted representation string
-
clip
¶ Alias for field number 4
-
domain
¶ Alias for field number 3
-
name
¶ Alias for field number 0
-
numpy
¶ Alias for field number 1
-
openimageio
¶ Alias for field number 2
-
-
colour.io.image.
read_image
(path, bit_depth=u'float32')[source]¶ Reads given image using OpenImageIO.
Parameters: - path (unicode) – Image path.
- bit_depth (unicode, optional) – {‘float32’, ‘uint8’, ‘uint16’, ‘float16’}, Image bit_depth.
Returns: Image as a ndarray.
Return type: ndarray
Notes
- For convenience, single channel images are squeezed to 2d arrays.
Examples
>>> import os >>> path = os.path.join('tests', 'resources', 'CMSTestPattern.exr') >>> image = read_image_as_array(path)
-
colour.io.image.
write_image
(image, path, bit_depth=u'float32')[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.
Returns: Definition success.
Return type: Examples
>>> import os >>> path = os.path.join('tests', 'resources', 'CMSTestPattern.exr') >>> image = read_image_as_array(path) >>> path = os.path.join('tests', 'resources', 'CMSTestPattern.png') >>> write_image(image, path, 'uint8') True