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, initial-scale=1" /> 10 <title>ImageMagick - Magick Image File Format</title> 11 <meta name="application-name" content="ImageMagick" /> 12 <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert digital images. Resize an image, crop it, change its shades and colors, add captions, and more." /> 13 <meta name="application-url" content="https://imagemagick.org" /> 14 <meta name="generator" content="PHP" /> 15 <meta name="keywords" content="magick, image, file, format, image processing software" /> 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-2020 ImageMagick Studio LLC" /> 23 <meta name="distribution" content="Global" /> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" /> 25 <meta property='og:url' content='../' /> 26 <meta property='og:title' content='ImageMagick' /> 27 <meta property='og:image' content='../images/logo.png' /> 28 <meta property='og:type' content='website' /> 29 <meta property='og:site_name' content='ImageMagick' /> 30 <meta property='og:description' content="Create, Edit, Compose, or Convert Digital Images" /> 31 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 32 <link href="../www/miff.html" rel="canonical" /> 33 <link href="../images/wand.png" rel="icon" /> 34 <link href="../images/wand.ico" rel="shortcut icon" /> 35 <link href="assets/magick.css" rel="stylesheet" /> 36</head> 37<body> 38 <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> 39 <div class="container-fluid"> 40 <a class="navbar-brand" href="../index.html"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a> 41 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#magick-navbars" aria-controls="magick-navbars" aria-expanded="false" aria-label="Toggle navigation"> 42 <span class="navbar-toggler-icon"></span> 43 </button> 44 45 <div class="collapse navbar-collapse" id="magick-navbars"> 46 <ul class="navbar-nav me-auto mb-2 mb-md-0"> 47 <li class="nav-item"> 48 <a class="nav-link " href="index.html">Home</a> 49 </li> 50 <li class="nav-item"> 51 <a class="nav-link " href="download.html">Download</a> 52 </li> 53 <li class="nav-item"> 54 <a class="nav-link " href="command-line-tools.html">Tools</a> 55 </li> 56 <li class="nav-item"> 57 <a class="nav-link " href="command-line-processing.html">CLI</a> 58 </li> 59 <li class="nav-item"> 60 <a class="nav-link " href="develop.html">Develop</a> 61 </li> 62 <li class="nav-item"> 63 <a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a> 64 </li> 65 <li class="nav-item"> 66 <iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe> 67 </li> 68 </ul> 69 <form class="d-flex form-inline" action="../www/search.html"> 70 <input class="form-control me-2" type="text" name="q" placeholder="Search" aria-label="Search"> 71 <button class="btn btn-outline-success" type="submit" name="sa">Search</button> 72 </form> 73 </div> 74 </div> 75 </nav> 76 77 <div class="container"> 78 <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script> 79 <ins class="adsbygoogle" 80 style="display:block" 81 data-ad-client="ca-pub-3129977114552745" 82 data-ad-slot="6345125851" 83 data-full-width-responsive="true" 84 data-ad-format="horizontal"></ins> 85 <script> 86 (adsbygoogle = window.adsbygoogle || []).push({}); 87 </script> 88 89 </div> 90 91 <main class="container"> 92 <div class="magick-template"> 93<div class="magick-header"> 94<h1 class="text-center">Magick Image File Format</h1> 95<p class="text-center"><a href="miff.html#miff-header">MIFF Header</a> • <a href="miff.html#binary">MIFF Binary Data</a></p> 96 97<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> 98 99<h2><a class="anchor" id="miff-header"></a>MIFF Header</h2> 100 101 102<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> 103 104<p>The following is a partial list of <var> key = value</var> combinations that are typically be found in a MIFF file:</p> 105 106<div class="table-responsive" style="font-size:87.5% !important;"> 107<table class="table table-sm table-hover"> 108 <tr> 109 <td>background-color = <var>color</var></td> 110 <td> </td> 111 </tr> 112 <tr> 113 <td>border-color = <var>color</var></td> 114 <td> </td> 115 </tr> 116 <tr> 117 <td>matte-color = <var>color</var></td> 118 <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> 119 </tr> 120 <tr> 121 <td>class = { DirectClass, PseudoClass }</td> 122 <td>the type of binary pixel data stored in the MIFF file. If this key is not present, DirectClass pixel data is assumed.</td> 123 </tr> 124 <tr> 125 <td>colors = <var> value</var></td> 126 <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> 127 </tr> 128 <tr> 129 <td>colorspace = { RGB, CMYK, ... }</td> 130 <td>the colorspace of the pixel data. The default is RGB.</td> 131 </tr> 132 <tr> 133 <td>columns = value</td> 134 <td>the width of the image in pixels. This a required key and has no default value.</td> 135 </tr> 136 <tr> 137 <td>compression = {BZip, None, Zip, ... }</td> 138 <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> 139 </tr> 140 <tr> 141 <td>delay = <var>microseconds</var></td> 142 <td>the interframe delay in an image sequence in microseconds.</td> 143 </tr> 144 <tr> 145 <td>depth = { 8, 16, 32 }</td> 146 <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> 147 </tr> 148 <tr> 149 <td>dispose = <var>value</var></td> 150 <td>layer disposal method. Here are the valid values: 151 <ul> 152 <dd class="col-md-8">0. No disposal specified.</dd> 153 <dd class="col-md-8">1. Do not dispose between frames.</dd> 154 <dd class="col-md-8">2. Overwrite frame with background color from header.</dd> 155 <dd class="col-md-8">3. Overwrite with previous frame.</dd> 156 </ul> 157 </td> 158 </tr> 159 <tr> 160 <td>gamma = <var>value</var></td> 161 <td>the gamma of the image. If it is not specified, a gamma of 1.0 (linear brightness response) is assumed.</td> 162 </tr> 163 <tr> 164 <td>id = ImageMagick</td> 165 <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> 166 </tr> 167 <tr> 168 <td>iterations = <var>value</var></td> 169 <td>the number of times an image sequence loops before stopping.</td> 170 </tr> 171 <tr> 172 <td>label = { <var>string </var>]</td> 173 <td>defines a short title or caption for the image. If any whitespace appears in the label, it must be enclosed within braces.</td> 174 </tr> 175 <tr> 176 <td>matte = { True, False }</td> 177 <td>specifies whether a the image has matte data. Matte data is generally useful for image compositing.</td> 178 </tr> 179 <tr> 180 <td>montage = <var><width>x<height>[+-]<x offset>[+-]<y offset></var></td> 181 <td>size and location of the individual tiles of a composite image. 182 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> 183 </tr> 184 <tr> 185 <td>page = <var>value</var></td> 186 <td>preferred size and location of an image canvas.</td> 187 </tr> 188 <tr> 189 <td>profile-icc = <var>value</var></td> 190 <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> 191 </tr> 192 <td>red-primary = <var>x,y</var></td> 193 <td> </td> 194 <tr> 195 <td>green-primary = <var>x,y</var></td> 196 <td> </td> 197 </tr> 198 <td>blue-primary = <var>x,y</var></td> 199 <td> </td> 200 <tr> 201 <td>white-point = <var>x,y</var></td> 202 <td>this optional key reflects the chromaticity primaries and white point.</td> 203 </tr> 204 <tr> 205 <td>rendering-intent = { saturation, perceptual, absolute, relative }</td> 206 <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> 207 </tr> 208 <tr> 209 <td>resolution = <var><x-resolution>x<y-resolution></var></td> 210 <td>vertical and horizontal resolution of the image. See units for the specific resolution units (e.g. pixels per inch).</td> 211 </tr> 212 <tr> 213 <td>rows = <var>value</var></td> 214 <td>the height of the image in pixels. This a required key and has no default value.</td> 215 </tr> 216 <tr> 217 <td>scene = <var>value</var></td> 218 <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> 219 </tr> 220 <tr> 221 <td>signature = <var>value</var></td> 222 <td>this optional key contains a string that uniquely identifies the image pixel contents. NIST's SHA-256 message digest algorithm is recommended.</td> 223 </tr> 224 <tr> 225 <td>units = { pixels-per-inch, pixels-per-centimeter }</td> 226 <td>image resolution units.</td> 227 </tr> 228</table></div> 229 230<p>Other key value pairs are permitted. If a value contains whitespace it must be enclosed with braces as illustrated here:</p> 231 232<pre class="highlight"><code>id=ImageMagick 233class=PseudoClass colors=256 matte=False 234columns=1280 rows=1024 depth=8 235compression=RLE 236colorspace=RGB 237copyright={© 1999-2017 ImageMagick Studio LLC} 238⋮ 239</code></pre> 240 241<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> 242 243<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> 244 245<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> 246 247<p>The header is separated from the image data by a <code>:</code> character immediately followed by a <var>newline</var>.</p> 248 249<h2><a class="anchor" id="binary"></a>MIFF Binary Data</h2> 250 251<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> 252 253<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> 254 255<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 256or 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> 257 258<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> 259 260<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> 261 262</div> 263 </div> 264 </main><!-- /.container --> 265 <footer class="magick-footer"> 266 <div class="container-fluid"> 267 <a href="security-policy.html">Security</a> • 268 <a href="news.html">News</a> 269 270 <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> 271 272 <a href="links.html">Related</a> • 273 <a href="sitemap.html">Sitemap</a> 274 <br/> 275 <a href="support.html">Sponsor</a> • 276 <a href="cite.html">Cite</a> • 277 <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 278 <a href="https://imagemagick.org/script/contact.php">Contact Us</a> 279 <br/> 280 <a href="https://github.com/imagemagick/imagemagick" target="_blank" rel="noopener" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 499.36" width="2%" height="2%" role="img" focusable="false"><title>GitHub</title><path fill="currentColor" fill-rule="evenodd" d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z"/></svg></a> • 281 <a href="https://twitter.com/imagemagick" target="_blank" rel="noopener" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 416.32" width="2%" height="2%" role="img" focusable="false"><title>Twitter</title><path fill="currentColor" d="M160.83 416.32c193.2 0 298.92-160.22 298.92-298.92 0-4.51 0-9-.2-13.52A214 214 0 0 0 512 49.38a212.93 212.93 0 0 1-60.44 16.6 105.7 105.7 0 0 0 46.3-58.19 209 209 0 0 1-66.79 25.37 105.09 105.09 0 0 0-181.73 71.91 116.12 116.12 0 0 0 2.66 24c-87.28-4.3-164.73-46.3-216.56-109.82A105.48 105.48 0 0 0 68 159.6a106.27 106.27 0 0 1-47.53-13.11v1.43a105.28 105.28 0 0 0 84.21 103.06 105.67 105.67 0 0 1-47.33 1.84 105.06 105.06 0 0 0 98.14 72.94A210.72 210.72 0 0 1 25 370.84a202.17 202.17 0 0 1-25-1.43 298.85 298.85 0 0 0 160.83 46.92"/></svg></a> 282 <br/> 283 <small>© 1999-2021 ImageMagick Studio LLC</small> 284 </div> 285 </footer> 286 287 <!-- Javascript assets --> 288 <script src="assets/magick.js" ></script> 289 </body> 290</html> 291<!-- Magick Cache 13th February 2021 12:18 -->