MIFF: Summary from the Encyclopedia of Graphics File Formats

MIFF File Format Summary

Also Known As: Machine Independent File Format


Type Bitmap
Colors 16 million
Compression RLE, Q-coder, JPEG predictive arithmetic compression
Maximum Image Size Unlimited
Multiple Images Per File No
Numerical Format NA
Originator John Cristy
Platform X Window System
Supporting Applications ImageMagick
See Also JFIF

Usage
Bitmap still image and animation storage format.

Comments
MIFF is the native image file format for the X Window System-based ImageMagick utilities.

Vendor specifications are available for this format.

Code fragments are available for this format.

Sample images are available for this format.


MIFF (Machine Independent File Format) is a platform-independent format for storing bitmap images. MIFF is part of the ImageMagick toolkit of image manipulation utilities for the X Window System. ImageMagick is capable of converting many different image file formats to and from MIFF, in addition to creating and displaying animated bitmap image presentations.

Contents:
File Organization
File Details
For Further Information

File Organization

The MIFF header is composed entirely of ASCII characters. The fields in the header are keyword and value combinations in the keyword=value format, with each keyword and value separated by an equal sign (=).

Each keyword=value combination is delimited by at least one control or whitespace character. Comments may appear in the header section and are always delimited by braces. The MIFF header always ends with a colon (:) character, followed by a newline character. It is also common for a formfeed and a newline character to appear before the colon.

The following is a list of keyword=value combinations that may be found in a MIFF file:

class=DirectClass or class=PseudoClass

class indicates the type of binary image data stored in the MIFF file. If this keyword is not present, DirectClass image data is assumed.

colors=value

colors specifies the number of colors in a DirectClass image. For a PseudoColor image this keyword specifies the size of the colormap. If this keyword is not present in the header, and the image is PseudoColor, then a linear colormap is used with the image data.

columns=value

columns indicates the width of the image in pixels. This is a required keyword and has no default.

compression=QEncoded or compression=RunlengthEncoded

compression indicates the type of algorithm used to compress the image data. If this keyword is not present, the image data is assumed to be uncompressed.

id=ImageMagick

The id keyword identifies the file as a MIFF-format image file. This keyword is required and has no default.

packets=value

packets specifies the number of compressed color packets in the image data section. This keyword is optional for RunlengthEncoded images, mandatory for QEncoded images, and not used for uncompressed images.

rows=value

rows indicates the height of the image in pixels. This is a required keyword and has no default.

scene=value

scene indicates the sequence number for this MIFF image file. This optional keyword is used when a MIFF image file is one in a sequence of files used in an animation.

signature=value

The optional keyword signature contains a string that uniquely identifies the image colormap. Unique colormap identifiers are normally used when animating a sequence of PseudoClass images.

The following is a sample MIFF header. In this example, <FF> is a formfeed character:

{
	A sample MIFF header
}
id=ImageMagick
class=PseudoClass  colors=256
compression=RunlengthEncoded  packets=10672
columns=800  rows=600 {size of the image}
scene=1  signature=d79e1c308aa5bbcdeea8ed63df412da9
<FF>
:

Note that keyword=value combinations may be separated by newlines or spaces and may occur in any order within the header. Comments (within braces) may appear anywhere before the colon.

Following the header is the binary image data itself. How the image data is formatted depends upon the class of the image as specified (or not specified) by the value of the class keyword in the header.

File Details

DirectClass images (class=DirectClass) are continuous tone, RGB images stored as intensity values in red-green-blue order. Each color value is one byte in size and there are three bytes per pixel. The total number of pixels in a DirectClass image is calculated by multiplying the rows value by the columns value in the header.

PseudoClass images (class=PseudoClass) are colormapped RGB images. The colormap is stored as a series of red-green-blue pixel values, each value being a byte in size. The number of map entries is indicated by the colors keyword in the header, with a maximum of 65,535 total entries allowed. The colormap data occurs immediately following the header.

PseudoClass image data is an array of index values into the color map. If there are 256 or fewer colors in the image, each byte of image data contains an index value. If the image contains more than 256 colors, then the index value is stored in two contiguous bytes with the most significant byte being first. The total number of pixels in a PseudoClass image is calculated by multiplying the rows value by the columns value in the header.

MIFF is capable of storing a digital signature for colormapped images. This signature was developed for use when animating a sequence of images on a colormapped X server. All of the signatures in a sequence of MIFF files are checked, and if they all match, you do not need to compute a global colormap.

The default colormap identifier is a digital signature computed using the RSA Data Security MD4 Digest Algorithm. (See a description of this algorithm in RFC 1186, October 1990.) The colormap signature is computed if the MIFF file is part of a scene (i.e., the scene value does not equal 0).

The image data in a MIFF file may be uncompressed or may be compressed using one of two algorithms. The predictive arithmetic compression algorithm found in the JPEG compression scheme (Chapter 9, Data Compression) may be used to encode either DirectColor or PseudoColor image data into packets of compressed data. Older MIFF files will use the IBM Q-coder algorithm to QEncode image data. The number of Q-encoded packets stored in the file is specified by the packets keyword in the header.

A less costly alternative to the Q-coder algorithms is a simple, run-length encoding (RLE) algorithm. For DirectColor images, runs of identical pixel values (not BYTE values) are encoded into a series of four-byte packets. The first three bytes of the packet contain the red, green, and blue values of the pixel in the run. The fourth byte contains the number of pixels in the run. This value may be in the range of 0 to 255 and is one less than the actual number of pixels in the run. For example, a value of 147 indicates that there are 148 pixels in the run.

For PseudoColor images, the same RLE algorithm is used. Runs of identical index values are encoded into packets. Each packet contains the colormap index value followed by the number of index values in the run. The number of bytes in a PseudoColor RLE packet will be either two or three, depending upon the size of the index values. The number of RLE packets stored in the file is specified by the packets keyword in the header, but is not required.

For Further Information

For further information about MIFF, see the specification included on the CD-ROM.

ImageMagick was created by John Cristy, of E.I. duPont de Nemours & Company, and is copyright by duPont. The software is included on the CD-ROM. See the following sites for ImageMagick:

http://www.wizards.dupont.com/cristy/ImageMagick.html

ImageMagick homepage

http://web.cnam.fr/Images/Usenet/docs/imagemagick.html

What is ImageMagick?

ftp://ftp.wizards.dupont.com/pub/ImageMagick/

ImageMagick FTP site

For more information about MIFF, you can contact:

duPont de Nemour & Company
Attn: John Cristy
Central Research and Development
Experimental Station
P.O. Box 80328
Room 162-A
Wilmington, DE 19880-0328
Voice: 302-695-1159
Email: [email protected]

For information about the JPEG predictive arithmetic compression algorithm, see the section called "JPEG Compression" in Chapter 9.

For information about the IBM-patented Q-coder compression algorithm, see the following reference:

Mitchell, J. L. and W.B. Pennebaker, "Software Implementations of the Q-Coder," IBM Journal of Research Development, vol. 32, no. 6, November 1988, pp. 753-74.


This page is taken from the Encyclopedia of Graphics File Formats and is licensed by O'Reilly under the Creative Common/Attribution license.

More Resources