Image Storage

Essentially all the file formats save the same image data. There is no such thing like a GIF image, instead we have a color indexed image that can be saved in a file with a GIF format, or a TIFF format, etc. However the compression encoding can be lossy and degrade the original image. The point is file formats and image data are two different things.

A file format is a file organization of the image data and its attributes. The IM library model considers all the file formats under the same model, including image, video, animation, stacks and volume file formats. When there is more than one image each one is treated as an independent frame. Each frame can have its own parameters and set of attributes.

The abstract model we use has the following structure:

Format Identifier
Compression
Image Count
Image Information:
parameters, attributes, palette
Image Data
Image Information:
parameters, attributes, palette
Image Data
...

The compression is usually the same for all the images in the file, but it can be changed after loading an image. For tradicional file formats image count is always 1. Image information must always be loaded or saved before image data.

We consider only formats that starts with a signature so we can recognize the format without using its file extension. If there is more than one driver that handles the same signature the first registered driver will open the file. Since the internal drivers are automatically registered all the external drivers can be loaded first if no imFile function has been called. In this way you can also control which external driver goes first.