imagemagick/www/miff.html

288 lines
19 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>ImageMagick - Magick Image File Format</title>
<meta name="application-name" content="ImageMagick" />
<meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." />
<meta name="application-url" content="https://legacy.imagemagick.org" />
<meta name="generator" content="PHP" />
<meta name="keywords" content="magick, image, file, format, image converter, image resizer, image editor, photo editor, jpg converter, png converter, tiff converter, vector images, online, free, swiss army" />
<meta name="rating" content="GENERAL" />
<meta name="robots" content="INDEX, FOLLOW" />
<meta name="generator" content="ImageMagick Studio LLC" />
<meta name="author" content="ImageMagick Studio LLC" />
<meta name="revisit-after" content="2 DAYS" />
<meta name="resource-type" content="document" />
<meta name="copyright" content="Copyright (c) 1999-2020 ImageMagick Studio LLC" />
<meta name="distribution" content="Global" />
<meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
<meta property='og:url' content='https://legacy.imagemagick.org/' />
<meta property='og:title' content='ImageMagick Legacy' />
<meta property='og:image' content='https://legacy.imagemagick.org/images/logo.png' />
<meta property='og:type' content='website' />
<meta property='og:site_name' content='ImageMagick Legacy' />
<meta property='og:description' content="Create, Edit, Compose, or Convert Bitmap Images" />
<meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
<meta name="msvalidate.01" content="103012B23499FEB70AEA89C83C274AC7" />
<link href="miff.html" rel="canonical" />
<link href="../images/wand.png" rel="icon" />
<link href="../images/wand.ico" rel="shortcut icon" />
<link href="assets/magick.css" rel="stylesheet" />
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="../index.html"><img class="d-block" id="wand" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="navbarsMagick" style="">
<ul class="navbar-nav mr-auto">
<li class="nav-item ">
<a class="nav-link" href="../index.html">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item ">
<a class="nav-link" href="download.html">Download</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="command-line-tools.html">Tools</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="command-line-processing.html">Command-line</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="develop.html">Develop</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick6/discussions">Community</a>
</li>
<li class="nav-item">
<iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe>
</li>
</ul>
</div>
<form class="form-inline my-2 my-lg-0" action="https://legacy.imagemagick.org/script/search.php">
<input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search" />
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button>
</form>
</nav>
<div role="main" class="container">
<script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-3129977114552745"
data-ad-slot="6345125851"
data-full-width-responsive="true"
data-ad-format="horizontal"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<main class="container">
<div class="magick-template">
<div class="magick-header">
<h1 class="text-center">Magick Image File Format</h1>
<p class="text-center"><a href="miff.html#miff-header">MIFF Header</a><a href="miff.html#binary">MIFF Binary Data</a></p>
<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>
<h2><a class="anchor" id="miff-header"></a>MIFF Header</h2>
<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>
<p>The following is a partial list of <var> key = value</var> combinations that are typically be found in a MIFF file:</p>
<div class="table-responsive" style="font-size:87.5% !important;">
<table class="table table-sm table-hover">
<tr>
<td>background-color = <var>color</var></td>
<td> </td>
</tr>
<tr>
<td>border-color = <var>color</var></td>
<td> </td>
</tr>
<tr>
<td>matte-color = <var>color</var></td>
<td>these optional keys reflect the image background, border, and matte colors respectively. A <a href="color.html">color</a> can be a name (e.g. white) or a hex value (e.g. #ccc).</td>
</tr>
<tr>
<td>class = { DirectClass, PseudoClass }</td>
<td>the type of binary pixel data stored in the MIFF file. If this key is not present, DirectClass pixel data is assumed.</td>
</tr>
<tr>
<td>colors = <var> value</var></td>
<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>
</tr>
<tr>
<td>colorspace = { RGB, CMYK, ... }</td>
<td>the colorspace of the pixel data. The default is RGB.</td>
</tr>
<tr>
<td>columns = value</td>
<td>the width of the image in pixels. This a required key and has no default value.</td>
</tr>
<tr>
<td>compression = {BZip, None, Zip, ... }</td>
<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>
</tr>
<tr>
<td>delay = <var>microseconds</var></td>
<td>the interframe delay in an image sequence in microseconds.</td>
</tr>
<tr>
<td>depth = { 8, 16, 32 }</td>
<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>
</tr>
<tr>
<td>dispose = <var>value</var></td>
<td>layer disposal method. Here are the valid values:
<ul>
<dd class="col-md-8">0. No disposal specified.</dd>
<dd class="col-md-8">1. Do not dispose between frames.</dd>
<dd class="col-md-8">2. Overwrite frame with background color from header.</dd>
<dd class="col-md-8">3. Overwrite with previous frame.</dd>
</ul>
</td>
</tr>
<tr>
<td>gamma = <var>value</var></td>
<td>the gamma of the image. If it is not specified, a gamma of 1.0 (linear brightness response) is assumed.</td>
</tr>
<tr>
<td>id = ImageMagick</td>
<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>
</tr>
<tr>
<td>iterations = <var>value</var></td>
<td>the number of times an image sequence loops before stopping.</td>
</tr>
<tr>
<td>label = { <var>string </var>]</td>
<td>defines a short title or caption for the image. If any whitespace appears in the label, it must be enclosed within braces.</td>
</tr>
<tr>
<td>matte = { True, False }</td>
<td>specifies whether a the image has matte data. Matte data is generally useful for image compositing.</td>
</tr>
<tr>
<td>montage = <var>&lt;width&gt;x&lt;height&gt;[+-]&lt;x offset&gt;[+-]&lt;y offset&gt;</var></td>
<td>size and location of the individual tiles of a composite image.
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>
</tr>
<tr>
<td>page = <var>value</var></td>
<td>preferred size and location of an image canvas.</td>
</tr>
<tr>
<td>profile-icc = <var>value</var></td>
<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>
</tr>
<td>red-primary = <var>x,y</var></td>
<td> </td>
<tr>
<td>green-primary = <var>x,y</var></td>
<td> </td>
</tr>
<td>blue-primary = <var>x,y</var></td>
<td> </td>
<tr>
<td>white-point = <var>x,y</var></td>
<td>this optional key reflects the chromaticity primaries and white point.</td>
</tr>
<tr>
<td>rendering-intent = { saturation, perceptual, absolute, relative }</td>
<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>
</tr>
<tr>
<td>resolution = <var>&lt;x-resolution&gt;x&lt;y-resolution&gt;</var></td>
<td>vertical and horizontal resolution of the image. See units for the specific resolution units (e.g. pixels per inch).</td>
</tr>
<tr>
<td>rows = <var>value</var></td>
<td>the height of the image in pixels. This a required key and has no default value.</td>
</tr>
<tr>
<td>scene = <var>value</var></td>
<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>
</tr>
<tr>
<td>signature = <var>value</var></td>
<td>this optional key contains a string that uniquely identifies the image pixel contents. NIST's SHA-256 message digest algorithm is recommended.</td>
</tr>
<tr>
<td>units = { pixels-per-inch, pixels-per-centimeter }</td>
<td>image resolution units.</td>
</tr>
</table></div>
<p>Other key value pairs are permitted. If a value contains whitespace it must be enclosed with braces as illustrated here:</p>
<pre class="highlight"><code>id=ImageMagick
class=PseudoClass colors=256 matte=False
columns=1280 rows=1024 depth=8
compression=RLE
colorspace=RGB
copyright={© 1999-2017 ImageMagick Studio LLC}
&#8942;
</code></pre>
<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>
<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>
<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>
<p>The header is separated from the image data by a <code>:</code> character immediately followed by a <var>newline</var>.</p>
<h2><a class="anchor" id="binary"></a>MIFF Binary Data</h2>
<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>
<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>
<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
or 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>
<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>
<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>
</div>
</div>
</main><!-- /.container -->
<footer class="magick-footer">
<div class="container">
<p><a href="security-policy.html">Security</a>
<a href="news.html">News</a>
<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>
<a href="links.html">Related</a>
<a href="sitemap.html">Sitemap</a>
<br/>
<a href="support.html">Sponsor</a>
<a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
<a href="https://imagemagick.org/script/contact.php">Contact Us</a>
<br/>
<a href="https://github.com/imagemagick/imagemagick6" 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>
<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>
<br/>
<small>© 1999-2021 ImageMagick Studio LLC</small></p>
</div>
</footer>
<!-- Javascript assets -->
<script>window.jQuery || document.write('&lt;script src="assets/jquery.slim.min.js"&gt;&lt;\/script&gt;')</script><script src="assets/bootstrap.bundle.min.js" crossorigin="anonymous" />
</body>
</html>
<!-- Magick Cache 1st January 2021 19:38 -->