Image
=====

Overview
--------

A :class:`Draft.Image` holds an actual image, along with the image's width and height, its channel names and a :ref:`file channel map <Concepts/ImageFileChannelMap>`.

Implementation Details
----------------------

In Draft, the method :meth:`~Draft.Image.CreateImage` creates a new image and the method :meth:`~Draft.Image.ReadFromFile` reads an image from file. An image can be written to file using the method :meth:`~Draft.Image.WriteToFile`.

The image's :attr:`~Draft.Image.width` and :attr:`~Draft.Image.height` are stored as properties. You can modify those properties using the method :meth:`~Draft.Image.Resize`.

To get the image's channel names, you can use the method :meth:`~Draft.Image.GetChannelNames`. You can also manipulate the image's channels using the methods :meth:`~Draft.Image.SetChannel`, :meth:`~Draft.Image.HasChannel`, :meth:`~Draft.Image.RemoveChannel`, :meth:`~Draft.Image.RenameChannel` and :meth:`~Draft.Image.SetToColor`.

A file channel map is used to specify on write and retrieve on read the bit depth and type of the image channels. It is possible to access the file channel map using the methods :meth:`~Draft.Image.SetFileChannelMap` and :meth:`~Draft.Image.GetFileChannelMap`. For more details, see the section :ref:`Concepts/ImageFileChannelMap` in Concepts.

Beside the bit depth and type of the image channels, other image saving settings can be specified using :class:`Draft.ImageInfo`. Consult the section :ref:`Concepts/ImageInfo` in Concepts for more information.  

Relevant Cookbook Recipes
-------------------------

* :ref:`Basic/CreateAnImage`
* :ref:`Basic/ResizeAnImage`
* :ref:`Basic/WriteAnImageWithFileChannelMap`

