formats.image

Image encoding/decoding.

class ImageFileException: object.Exception;

Exception thrown at errors related to image files.

enum ImageFileFormat;

Image file formats, e.g. PNG, GIF, etc.

PNG

PNG (Portable Network Graphics).

Auto

Automatic file format detection based on file extension (.png for PNG files).

void writeImage(ref const Image image, VFSFile file, ImageFileFormat fileFormat = (ImageFileFormat).Auto);

Write an image to file.

Parameters:
Image image Image to write.
fileName File to write into.
ImageFileFormat fileFormat Image file format. Autodetected by default. If the format can't be autodetected, PNG format is used.
PNG is the only supported format at the moment (more formats may or may not be added in future). Also, only 24-bit RGB and 32-bit RGBA color formats are supported at the moment.
Throws:
VFSException if the image could not be written. ImageFileException in the case of an encoding error, if the color format is not supported or file format could not be detected in case of autodetection.
void readImage(ref Image image, VFSFile file, ImageFileFormat fileFormat = (ImageFileFormat).Auto);

Read an image from a file.

Parameters:
Image image Image to read to. Any existing contents will be cleared.
fileName File to read from.
ImageFileFormat fileFormat Image file format. Autodetected by default. If the format can't be autodetected, PNG format is used.
PNG is the only supported format at the moment (more formats may or may not be added in future). Also, only 8-bit grayscale, 24-bit RGB and 32-bit RGBA color formats are supported at the moment.
Throws:
VFSException if the file could not be read from. ImageFileException if image data was invalid.