


MIFF(5)                                                   MIFF(5)


MIFF FILE FORMAT
       The Machine Independent File Format is described in this
       section.

       A MIFF image file consist of two sections.  The first
       section is composed of keywords describing the image in
       text form.  The next section is the binary image data.
       The two sections are separated by a : character
       immediately followed by a newline.  Generally, the first
       section has a form-feed and newline proceeding the :
       character.   You can then list the image keywords with
       more, without printing the binary image that follows the :
       separator.

       Each keyword must be separated by at least one space but
       can be separated with control characters such a form-feed
       or newline.

       A list of valid keywords follows:

       class=DirectClass | PseudoClass
            identifies the type of binary image stored within the
            file.

            This keyword is optional.  If it is not specified, a
            DirectClass image format is assumed.  An explanation
            of DirectClass and PseudoClass image data follows
            this list.

       colors=value
            specifies the number of colors in the image, and for
            pseudo-color images the size of the colormap.

            This keyword is optional.  However, if a colormap
            size is not specified, a linear colormap is assumed
            for pseudo-color images.

       columns=value
            is a required keyword and specifies the number of
            columns, or width in pixels, of the image.

       compression=QEncoded | RunlengthEncoded
            identifies how the image stored within the file is
            compressed.

            This keyword is optional.  If it is not specified,
            the image is assumed to be uncompressed.  A detailed
            explanation of runlength-encoded and Q-coder image
            compression follows this list.

       id=ImageMagick
            is a required keyword and identifies this file as a
            MIFF image.




X Version 11              1 January 1991                        1





MIFF(5)                                                   MIFF(5)


       packets=value
            specifies the number of compressed color packets in
            the image data section.

            This keyword is optional, but recommended, for
            runlength-encoded image compression.  It is required
            for Q-encoded image compression.  A detailed
            explanation of image compression follows this list.

       rows=value
            is a required keyword and specifies the number of
            rows, or height in pixels, of the image.

       scene=value
            is an optional keyword and is a reference number for
            sequencing of images.

            This keyword is typically useful for animating a
            sequence of images.

       Comments can be included in the keyword section.  Comments
       must begin with a { character and end with a } character.

       An example keyword section follows:

           {
             Rendered via Dore by Sandy Hause.
           }
           id=ImageMagick
           class=PseudoClass  colors=256
           compression=RunlengthEncoded  packets=27601
           columns=1280  rows=1024
           scene=1
           ^L
           :

       The binary image data that follows the keyword text is
       stored in one of two binary classes as specified by the
       class keyword: DirectClass or PseudoClass.

       Use the DirectClass class to store continuous-tone images.
       DirectClass requires that the image pixels immediately
       follow the keyword text and be stored as binary red,
       green, and blue intensity values.  The total number of
       pixels expected is equal to the number of pixel columns
       times the number of pixel rows as specified by the columns
       and rows keywords.

       If the compression keyword is not specified, a red, green,
       and blue byte in that order is expected for each pixel of
       the image.

       If compression is QEncoded, each red, green, and blue byte
       intensity value is encoded using the Q-coder compression



X Version 11              1 January 1991                        2





MIFF(5)                                                   MIFF(5)


       algorithm.  Use the packets keyword to specify the total
       number of Q-encoded packets that comprise the image.
       Refer to "Sofware implementations of the Q-Coder", by
       Mitchell, J. L. and Pennebaker, W.B. (IBM Journal Res.
       Development, Volume 32, Number 6, November 1988, pages 753
       - 774) for implementation specific details.

       If compression is RunlengthEncoded, each red, green, and
       blue byte intensity value is followed by a count byte.
       This value specifies the number of horizonally contiguous
       pixels in the image of that color.  The count (0-255) is
       one less than the actual number of contiguous pixels; thus
       a single packet can represent from 1 up to 256 identical
       pixels.  The total number of pixels specified by the
       individual count bytes must add up to the number of pixel
       columns times the number of pixel rows as specified by the
       columns and rows keywords.  Use packets to specify the
       total number of runlength-encoded packets that comprise
       the image.

       Use the PseudoClass class to store pseudo-color images.
       PseudoClass requires that the image colormap and pseudo-
       color pixels immediately follow the keyword text.  The
       colormap is stored as contiguous red, green, and blue
       intensity values.  The number of intensity values expected
       is determined by the colors keyword.  Note, an image
       colormap is restricted to at most 65535 entries.  The
       binary pseudo-color image is stored as indexes into the
       colormap.  If the colormap size exceeds 256 entries, then
       each colormap index is two bytes each with the most-
       significant-byte first.  The total number of pixels
       expected is equal to the number of pixel columns times the
       number of pixel rows as specified by the columns and rows
       keywords.

       If the compression keyword is not specified, a colormap
       index is expected for each pixel of the image.

       If compression is QEncoded, each colormap index is encoded
       using the Q-coder compression algorithm.  Use the packets
       keyword to specify the total number of Q-encoded packets
       comprise the image.  Refer to "Sofware implementations of
       the Q-Coder", by Mitchell, J. L. and Pennebaker, W.B. (IBM
       Journal Res. Development, Volume 32, Number 6, November
       1988, pages 753 - 774) for implementation specific
       details.

       If compression is RunlengthEncoded, each colormap index is
       followed by a count byte. This value  specifies the number
       of horizonally contiguous pixels in the image of that
       color.  The count (0-255) is one less than the actual
       number of contiguous pixels; thus a single packet can
       represent from 1 up to 256 identical pixels.  The total
       number of pixels specified by the individual count bytes



X Version 11              1 January 1991                        3





MIFF(5)                                                   MIFF(5)


       must add up to the number of pixels expected in the image
       as specified by the columns and rows keywords.  Use
       packets to specify the total number of runlength-encoded
       packets that comprise the image.





















































X Version 11              1 January 1991                        4



