,ImageMagick Image File Format4NF,
@


@Magick Image File Format (MIFF) is a platform-independent?format for storing bitmap images. MIFF is a part of theIImageMagick toolkit of image manipulationKutilities for the X Window System. ImageMagick is capable ofDconverting many different image file formats to and from MIFF2(e.g. JPEG, XPM, TIFF, etc.).

<A MIFF image file consist of two sections. The first7section is a header composed of keywords describing the9image in text form. The next section is the binary imageBdata. The header is separated from the image data by a :3character immediately followed by a newline.

BThe MIFF header is composed entirely of LATIN-1 characters.:The fields in the header are keyword and value combinationJin the keyword=value format, with each keyword and valueEseparated by an equal sign (=). Each keyword=value3combination is delimited by at least one control or8whitespace character. Comments may appear in the headerCsection and are always delimited by braces. The MIFF header>always ends with a colon (:) character, followed by a2newline character. It is also common for aformfeed and aAnewline character to appear before the colon. You can thenAlist the image keywords with more(1), without printing the.binary image that follows the colon separator.

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


#
class=DirectClass#
class=PseudoClassJ
the type of binary image data stored in the MIFF file. If thisAkeyword is not present, DirectClass image data is assumed.



colors=value8
the number of colors in a DirectClass image.:For a PseudoClass image, this keyword specifies the5size of the colormap. If this keyword is not present<in the header, and the image is PseudoClass, a linear3256 color grayscale colormap is used with the imagedata.



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

.

compression=RunlengthEncoded!
compression=Zip
the type of algorithm6 used to compress the image data. If this keyword is. not present, the image data is assumed to be uncompressed.

0

delay <1/100ths of a second>K
the interframe delay in an image sequence. The maximum delay is 65535.



depth=8
depth=16@
depth of a single color value representing values from 0 toO 255 (depth 8) or 65535 (depth 16). If this keyword is absent, a depth of 8 isassumed.



gamma=value
;gamma of the image. If it is not specified, a gamma of 1.0((linear brightness response) is assumed,

id=ImageMagick-
identify the file as a MIFF-format0image file. This keyword is required and has no6default. Although this keyword can appear anywhere in7the header, it should start as the first keyword of the2header in column 1. This will allow programs like:file(1) to easily identify the file as MIFF.



label="value"N
this optional keyword defines a short title or caption for the image. IfFany whitespace appears in the label, it must be enclosed within doublequotes.



matte=True
matte=False4
specifies whether a DirectClass image has7 matte data. Matte data is generally useful for imageC compositing. This keyword has no meaning for pseudocolor images.

?

montage=<width>x<height>{+-}<x5offset>{+-}<y offset>2
size and location of the individual tiles of a7composite image. See X(1) for details about thegeometry specification.

>

Use this keyword when the image is a composite of a number4of different tiles. A tile consists of an image andGoptionally a border and a label. <width> is the size in:pixels of each individual tile in the horizontal directionHand <height> is the size in the vertical direction. Each;tile must have an equal number of pixels in width and equal:in height. However, the width can differ from the height.K<x offset> is the offset in number of pixels from the<vertical edge of the composite image where the first tile ofHa row begins and <y offset> is the offset from the8horizontal edge where the first tile of a column begins.

@

If this keyword is specified, a directory of tile names must8follow the image header. The format of the directory isexplained below.



packets=value1
the number of compressed color packets in the1image data section. This keyword is optional for.RunlengthEncoded images, mandatory for GZip compressed images,$and not used for uncompressed image.



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



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

!

signature=valueE
this optional keyword contains a string that uniquely identifiesFthe image pixel contents. RSA's Data Security MD5 Digest Algorithm is recommended.

?The following is a sample MIFF header. In this example,#<FF> is a formfeed character:
      id=ImageMagick#      class=PseudoClass  colors=2561      compression=RunlengthEncoded  packets=27601      columns=1280  rows=1024
      scene=10      signature=d79e1c308aa5bbcdeea8ed63df412da9      {-         Rendered via Dore by Sandi Tennyson.      }      <FF>      :
JNote that keyword=value combinations may be separated by8newlines or spaces and may occur in any order within the<header. Comments (within braces) may appear anywhere before the colon.

CIf you specify the montage keyword in the header, follow the7header with a directory of image tiles. This directory7consists of a name for each tile of the composite image@separated by a newline character. The list is terminatedwith a NULL character.

>Following the header (or image directory if the montage:keyword is in the header) is the binary image data itself.9How the image data is formatted depends upon the class of9the image as specified (or not specified) by the value of'the class keyword in the header.

PDirectClass images (class=DirectClass) are continuous-tone,>RGB images stored as intensity values in red-green-blueNorder. Each color value is one byte in size for an image depth of 8 and thereLare three bytes per pixel (four with an optional matte value). If the depthPis 16, each color value is two bytes with the most significant byte being first.8The total number of pixels in a DirectClass image9is calculates by multiplying the rows value by the columnvalue in the header.

LPseudoClass images (class=PseudoClass) are colormapped IRGB images. The colormap is stored as a series of red-green-blue Ipixel values, each value being a byte in size. If the image depth is 16,Eeach colormap entry is two bytes with the most significant byte being@first. The number of colormap entries is indicated by the colors5keyword in the header, with a maximum of 65,535 total6entries allowed. The colormap data occurs immediately>following the header (or image directory if the montagekeyword is in the header).

BPseudoClass image data is an array of index values into the:color map. If these are 256 or fewer colors in the image,8each byte of image data contains an index value. If theGimage contains more than 256 colors or the depth is 16, the index value;is stored as two contiguous bytes with the most significant2byte 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.

BThe image data in a MIFF file may be uncompressed or may be8compressed using one of two algorithms. The compression5keyword in the header indicates how the image data is:compressed. The run-length encoding (RLE) algorithm may be:used to encode image data into packets of compressed data.CFor DirectClass images, runs of identical pixels values (not;BYTE values) are encoded into a series of four-byte packets;(five bytes if a matte value is included). The first three;bytes of the packet contain the red, green, and blue values6of the pixel in the run. The fourth byte contains the;number of pixels in the run. This value is 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 127 indicates that thereare 128 pixels in the run.

>For PseudoClass images, the same RLE algorithm is used.8Runs of identical index values are encoded into packets.9Each packet contains the colormap index value followed by;the number of index values in the run. The number of bytesEn a PseudoClass 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.

EUse Zip compression Eto achieve a greater compression ratio than run-length encoding. TheCnumber of compressed packets stored in the file is specified by the%packets keyword in the header.

:MIFF files may contain more than one image. Simply;concatenate each individual image (composed of a header andimage data) into one file.




Copyright

3Copyright 1997 E. I. du Pont de Nemours and Company:Permission to use, copy, modify, distribute, and sell this8software and its documentation for any purpose is hereby6granted without fee, provided that the above copyright8notice appear in all copies and that both that copyright6notice and this permission notice appear in supporting4documentation, and that the name of E. I. du Pont de1Nemours and Company not be used in advertising or4publicity pertaining to distribution of the software:without specific, written prior permission. E. I. du Pont9de Nemours and Company makes no representations about the4suitability of this software for any purpose. It is5provided "as is" without express or implied warranty.

2E. I. du Pont de Nemours and Company disclaims all6warranties with regard to this software, including all8implied warranties of merchantability and fitness, in no:event shall E. I. du Pont de Nemours and Company be liable9for any special, indirect or consequential damages or any6damages whatsoever resulting from loss of use, data or8profits, whether in an action of contract, negligence or6other tortious action, arising out of or in connection-with the use or performance of this software.




Authors

:John Cristy, H cristy@sympatico.org, E.I. du Pont de Nemours and CompanyIncorporated.


4[home page]IImage manipulation software that works like magic.