• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2
3
4
5<!DOCTYPE html>
6<html lang="en">
7<head>
8  <meta charset="utf-8"  />
9  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no"  />
10  <title>Magick Image File Format @ ImageMagick</title>
11  <meta name="application-name" content="ImageMagick" />
12  <meta name="description" content="Use ImageMagick® to create, edit, compose, or convert bitmap images. You can resize your image, crop it, change its shades and colors, add captions, among other operations." />
13  <meta name="application-url" content="https://imagemagick.org" />
14  <meta name="generator" content="PHP" />
15  <meta name="keywords" content="magick, image, file, format, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert" />
16  <meta name="rating" content="GENERAL" />
17  <meta name="robots" content="INDEX, FOLLOW" />
18  <meta name="generator" content="ImageMagick Studio LLC" />
19  <meta name="author" content="ImageMagick Studio LLC" />
20  <meta name="revisit-after" content="2 DAYS" />
21  <meta name="resource-type" content="document" />
22  <meta name="copyright" content="Copyright (c) 1999-2019 ImageMagick Studio LLC" />
23  <meta name="distribution" content="Global" />
24  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
25  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
26  <link href="../www/miff.html" rel="canonical" />
27  <link href="../images/wand.png" rel="icon" />
28  <link href="../images/wand.ico" rel="shortcut icon" />
29  <link href="assets/magick.css" rel="stylesheet" />
30</head>
31<body>
32  <header>
33  <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
34    <a class="navbar-brand" href="../index.html"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a>
35    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation">
36      <span class="navbar-toggler-icon"></span>
37    </button>
38
39    <div class="navbar-collapse collapse" id="navbarsMagick" style="">
40    <ul class="navbar-nav mr-auto">
41      <li class="nav-item ">
42        <a class="nav-link" href="../index.html">Home <span class="sr-only">(current)</span></a>
43      </li>
44      <li class="nav-item ">
45        <a class="nav-link" href="download.html">Download</a>
46      </li>
47      <li class="nav-item ">
48        <a class="nav-link" href="command-line-tools.html">Tools</a>
49      </li>
50      <li class="nav-item ">
51        <a class="nav-link" href="command-line-processing.html">Command-line</a>
52      </li>
53      <li class="nav-item ">
54        <a class="nav-link" href="resources.html">Resources</a>
55      </li>
56      <li class="nav-item ">
57        <a class="nav-link" href="develop.html">Develop</a>
58      </li>
59      <li class="nav-item">
60        <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a>
61      </li>
62    </ul>
63    <form class="form-inline my-2 my-lg-0" action="https://imagemagick.org/script/search.php">
64      <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search">
65      <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button>
66    </form>
67    </div>
68  </nav>
69  <div class="container">
70   <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
71         style="display:block"
72         data-ad-client="ca-pub-3129977114552745"
73         data-ad-slot="6345125851"
74         data-ad-format="auto"></ins>
75    <script>
76      (adsbygoogle = window.adsbygoogle || []).push({});
77    </script>
78
79  </div>
80  </header>
81  <main class="container">
82    <div class="magick-template">
83<div class="magick-header">
84<p class="text-center"><a href="miff.html#miff-header">MIFF Header</a> • <a href="miff.html#binary">MIFF Binary Data</a></p>
85
86<p class="lead magick-description">The Magick Image File Format (MIFF) is ImageMagick's own platform-independent format for storing bitmap images.  It has an advantage over other image formats in that it stores all metadata known to ImageMagick (e.g. image color profiles, comments, author, copyright, etc.), whereas, other formats may only support a small portion of available metadata or none at all.  A MIFF image file consist of two sections.  The first section is a header composed of keys describing the image in text form.  The next section is the binary image data.  We discuss these sections in detail below.</p>
87
88<h2><a class="anchor" id="miff-header"></a>MIFF Header</h2>
89
90
91<p>The MIFF header is composed entirely of ISO-8859-1 characters.  The fields in the header are key and value combination in the <var>key = value</var> format, with each key and value separated by an equal sign (<code>=</code>).  Each <var>key = value</var> 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 (<code>:</code>) character, followed by a <var>ctrl-Z</var> character.  It is also common to proceed the colon with a <var>formfeed</var> and a <var>newline</var> character.  The <var>formfeed</var> prevents the listing of binary data when using the <code>more</code> Unix program, whereas, the <var>ctrl-Z</var> has the same effect with the <code>type</code> command on the Windows command line.</p>
92
93<p>The following is a partial list of <var> key = value</var> combinations that are typically be found in a MIFF file:</p>
94
95<div class="table-responsive">
96<table class="table table-sm table-striped">
97  <tr>
98    <td>background-color = <var>color</var></td>
99    <td> </td>
100  </tr>
101  <tr>
102    <td>border-color = <var>color</var></td>
103    <td> </td>
104  </tr>
105  <tr>
106    <td>matte-color = <var>color</var></td>
107    <td>these optional keys reflect the image background, border, and matte colors respectively.  A <a href="../www/color.html">color</a> can be a name (e.g. white) or a hex value (e.g. #ccc).</td>
108  </tr>
109  <tr>
110    <td>class = { DirectClass, PseudoClass }</td>
111    <td>the type of binary pixel data stored in the MIFF file.  If this key is not present, DirectClass pixel data is assumed.</td>
112  </tr>
113  <tr>
114    <td>colors = <var> value</var></td>
115    <td>the number of colors in a DirectClass image. For a PseudoClass image, this key specifies the number of entries in the colormap.  If this key is not present in the header, and the image is PseudoClass, a linear 256 color grayscale colormap is assumed.  The maximum number of colormap entries is 65536.</td>
116  </tr>
117  <tr>
118    <td>colorspace = { RGB, CMYK, ... }</td>
119    <td>the colorspace of the pixel data.  The default is RGB.</td>
120  </tr>
121  <tr>
122    <td>columns = value</td>
123    <td>the width of the image in pixels.  This a required key and has no default value.</td>
124  </tr>
125  <tr>
126    <td>compression = {BZip, None, Zip, ... }</td>
127    <td>the type of algorithm used to compress the image data.  If this key is not present, the pixel data is assumed to be uncompressed.</td>
128  </tr>
129  <tr>
130    <td>delay = <var>microseconds</var></td>
131    <td>the interframe delay in an image sequence in microseconds.</td>
132  </tr>
133  <tr>
134    <td>depth = { 8, 16, 32 }</td>
135    <td>the depth of a single color value representing values from 0 to 255 (depth 8), 0 - 65535 (depth 16), or 0 - 4294967295 (depth 32).  If this key is absent, a depth of 8 is assumed.</td>
136  </tr>
137  <tr>
138    <td>dispose = <var>value</var></td>
139    <td>layer disposal method.  Here are the valid values:
140	  <ul>
141	    <dd class="col-md-8">0. No disposal specified.</dd>
142  	  <dd class="col-md-8">1. Do not dispose between frames.</dd>
143  	  <dd class="col-md-8">2. Overwrite frame with background color from header.</dd>
144  	  <dd class="col-md-8">3. Overwrite with previous frame.</dd>
145  	</ul>
146    </td>
147  </tr>
148  <tr>
149    <td>gamma = <var>value</var></td>
150    <td>the gamma of the image.  If it is not specified, a gamma of 1.0 (linear brightness response) is assumed.</td>
151  </tr>
152  <tr>
153    <td>id = ImageMagick</td>
154    <td>identifies the file as a MIFF-format image file.  This key is required and has no default.  Although this key can appear anywhere in the header, it should start as the first key of the header in column 1.  This will allow programs like <code>file</code>(1) to easily identify the file as MIFF.</td>
155	</tr>
156	<tr>
157    <td>iterations = <var>value</var></td>
158    <td>the number of times an image sequence loops before stopping.</td>
159  </tr>
160	<tr>
161    <td>label = { <var>string </var>]</td>
162    <td>defines a short title or caption for the image.  If any whitespace appears in the label, it must be enclosed within braces.</td>
163  </tr>
164	<tr>
165    <td>matte = { True, False }</td>
166    <td>specifies whether a the image has matte data.  Matte data is generally useful for image compositing.</td>
167  </tr>
168	<tr>
169    <td>montage = <var>&lt;width&gt;x&lt;height&gt;[+-]&lt;x offset&gt;[+-]&lt;y offset&gt;</var></td>
170  <td>size and location of the individual tiles of a composite image.
171  Use this key when the image is a composite of a number of different tiles.  A tile consists of an image and optionally a border and a label.  <var>Width</var> is the size in pixels of each individual tile in the horizontal direction and <var>height</var> 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.  <var>X offset</var> is the offset in number of pixels from the vertical edge of the composite image where the first tile of a row begins and <var>y offset</var> is the offset from the horizontal edge where the first tile of a column begins.  If this key is specified, a directory of tile names must follow the image header.  The format of the directory is explained below.</td>
172  </tr>
173	<tr>
174    <td>page = <var>value</var></td>
175    <td>preferred size and location of an image canvas.</td>
176  </tr>
177	<tr>
178    <td>profile-icc = <var>value</var></td>
179    <td>the number of bytes in the International Color Consortium color profile.  The profile is defined by the ICC profile specification located at <a href="http://www.color.org/icc_specs2.html">http://www.color.org/icc_specs2.html</a>.</td>
180  </tr>
181    <td>red-primary = <var>x,y</var></td>
182    <td> </td>
183	<tr>
184    <td>green-primary = <var>x,y</var></td>
185    <td> </td>
186  </tr>
187    <td>blue-primary = <var>x,y</var></td>
188    <td> </td>
189	<tr>
190    <td>white-point = <var>x,y</var></td>
191    <td>this optional key reflects the chromaticity primaries and white point.</td>
192  </tr>
193	<tr>
194    <td>rendering-intent = { saturation, perceptual, absolute, relative }</td>
195    <td>Rendering intent is the CSS-1 property that has been defined by the International Color Consortium (<a href="http://www.color.org">http://www.color.org</a>).</td>
196  </tr>
197	<tr>
198    <td>resolution = <var>&lt;x-resolution&gt;x&lt;y-resolution&gt;</var></td>
199    <td>vertical and horizontal resolution of the image.  See units for the specific resolution units (e.g. pixels per inch).</td>
200  </tr>
201	<tr>
202    <td>rows = <var>value</var></td>
203    <td>the height of the image in pixels.  This a required key and has no default value.</td>
204  </tr>
205	<tr>
206    <td>scene = <var>value</var></td>
207    <td>the sequence number for this MIFF image file.  This optional key is useful when a MIFF image file is one in a sequence of files used in an animation.</td>
208  </tr>
209	<tr>
210    <td>signature = <var>value</var></td>
211    <td>this optional key contains a string that uniquely identifies the image pixel contents.  NIST's SHA-256 message digest algorithm is recommended.</td>
212  </tr>
213	<tr>
214    <td>units = { pixels-per-inch, pixels-per-centimeter }</td>
215    <td>image resolution units.</td>
216  </tr>
217</table></div>
218
219<p>Other key value pairs are permitted.  If a value contains whitespace it must be enclosed with braces as illustrated here:</p>
220
221<pre class="highlight"><code>id=ImageMagick
222class=PseudoClass  colors=256  matte=False
223columns=1280  rows=1024  depth=8
224compression=RLE
225colorspace=RGB
226copyright={© 1999-2018 ImageMagick Studio LLC}
227&#8942;
228</code></pre>
229
230<p>Note that <var>key = value</var> combinations may be separated by <var>newlines</var> or spaces and may occur in any order within the header.  Comments (within braces) may appear anywhere before the colon.</p>
231
232<p>If you specify the montage key in the header, follow the header with a directory of image tiles.  This directory consists of a name for each tile of the composite image separated by a <var>newline</var> character.  The list is terminated with a NULL character.</p>
233
234<p>If you specify the color-profile key in the header, follow the header (or montage directory if the montage key is in the header) with the binary color profile.</p>
235
236<p>The header is separated from the image data by a <code>:</code> character immediately followed by a <var>newline</var>.</p>
237
238<h2><a class="anchor" id="binary"></a>MIFF Binary Data</h2>
239
240<p>Next comes 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 key in the header.</p>
241
242<p>DirectClass images are continuous-tone, images stored as RGB (red, green, blue), RGBA (red, green, blue, alpha), CMYK (cyan, yellow, magenta, black), or CMYKA (cyan, yellow, magenta, black, alpha)  intensity values as defined by the colorspace key. Each intensity value is one byte in length for images of depth 8 (0..255), two bytes for a depth of 16 (0..65535), and images of depth 32 (0..4294967295) require four bytes in most significant byte first order.</p>
243
244<p>PseudoClass images are colormapped RGB images. The colormap is stored as a series of red, green, and blue pixel values, each value being a byte in size. If the image depth is 16, each colormap entry consumes two bytes with the most significant byte being first. The number of colormap entries is defined by the colors key.  The colormap data occurs immediately following the header (or image directory if the montage key is in the header). PseudoClass image data is an array of index values into the color map. If there are 256
245or fewer colors in the image, each byte of image data contains an index value. If the image contains more than 256 colors or the image depth is 16, the index value is stored as two contiguous bytes with the most significant byte being first. If matte is true, each colormap index is followed by a 1 or 2-byte alpha value.</p>
246
247<p>The image pixel data in a MIFF file may be uncompressed, runlength encoded, Zip compressed, or BZip compressed. The compression key in the header defines how the image data is compressed. Uncompressed pixels are stored one scanline at a time in row order. Runlength-encoded compression counts runs of identical adjacent pixels and stores the pixels followed by a length byte (the number of identical pixels minus 1). Zip and BZip compression compresses each row of an image and precedes the compressed row with the length of compressed pixel bytes as a word in most significant byte first order.</p>
248
249<p>MIFF files may contain more than one image.  Simply concatenate each individual image (composed of a header and image data) into one file.</p>
250
251</div>
252    </div>
253  </main><!-- /.container -->
254  <footer class="magick-footer">
255    <p><a href="security-policy.html">Security</a> •
256    <a href="architecture.html">Architecture</a> •
257    <a href="links.html">Related</a> •
258     <a href="sitemap.html">Sitemap</a>
259
260    <a href="miff.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a>
261
262    <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
263    <a href="support.html">Donate</a> •
264    <a href="https://imagemagick.org/script/contact.php">Contact Us</a>
265    <br/>
266    <small>© 1999-2019 ImageMagick Studio LLC</small></p>
267  </footer>
268
269  <!-- Javascript assets -->
270  <script src="assets/magick.js" crossorigin="anonymous"></script>
271  <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.3.1/jquery.min.js"><\/script>')</script>
272</body>
273</html>
274<!-- Magick Cache 5th January 2019 11:43 -->