2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html version="-//W3C//DTD XHTML 1.1//EN"
5 xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
6 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7 xsi:schemaLocation="http://www.w3.org/1999/xhtml
8 http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
10 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
11 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4"/>
12 <title>ImageMagick: Format and Print Image Properties</title>
13 <meta http-equiv="content-language" content="en-US"/>
14 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
15 <meta http-equiv="reply-to" content="magick-users@imagemagick.org"/>
16 <meta name="application-name" content="ImageMagick"/>
17 <meta name="description" content="Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats. In addition, resize, rotate, shear, distort or transform images automagically."/>
18 <meta name="application-url" content="http://www.imagemagick.org"/>
19 <meta name="generator" content="PHP"/>
20 <meta name="keywords" content="format, print, image, properties, ImageMagick, PerlMagick, image processing, OpenMP, software development library, image, photo, software, Magick++, MagickWand"/>
21 <meta name="rating" content="GENERAL"/>
22 <meta name="robots" content="INDEX, FOLLOW"/>
23 <meta name="generator" content="ImageMagick Studio LLC"/>
24 <meta name="author" content="ImageMagick Studio LLC"/>
25 <meta name="revisit-after" content="2 DAYS"/>
26 <meta name="resource-type" content="document"/>
27 <meta name="copyright" content="Copyright (c) 1999-2012 ImageMagick Studio LLC"/>
28 <meta name="distribution" content="Global"/>
29 <link rel="icon" href="../images/wand.png"/>
30 <link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon"/>
31 <link rel="canonical" href="http://www.imagemagick.org" />
32 <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>
34 <!-- Add jQuery library -->
35 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
37 <!-- Add mousewheel plugin (this is optional) -->
38 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
41 <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/jquery.fancybox.css?v=2.0.6" type="text/css" media="screen" />
42 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/jquery.fancybox.pack.js?v=2.0.6"></script>
44 <!-- Optionally add helpers - button, thumbnail and/or media -->
45 <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.2" type="text/css" media="screen" />
46 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.2"></script>
47 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.0"></script>
49 <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-thumbs.css?v=2.0.6" type="text/css" media="screen" />
50 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=2.0.6"></script>
52 <script type="text/javascript">
53 $(document).ready(function() {
54 $(".fancybox").fancybox();
58 <!-- ImageMagick style -->
59 <style type="text/css" media="all">
60 @import url("../www/magick.css");
64 <body id="www-imagemagick-org">
67 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
68 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
69 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
70 })(window,document,'offline-script','//127.0.0.1/analytics.js','ga');
72 ga('create', 'UA-40133312-1', 'imagemagick.org');
73 ga('send', 'pageview');
76 <div class="titlebar">
77 <div style="margin: 17px auto; float: left;">
78 <script type="text/javascript">
80 google_ad_client = "pub-3129977114552745";
81 google_ad_slot = "5439289906";
82 google_ad_width = 728;
83 google_ad_height = 90;
86 <script type="text/javascript"
87 src="http://127.0.0.1/pagead/show_ads.js">
90 <a href="http://www.imagemagick.org/discourse-server/">
91 <img src="../images/logo.jpg"
92 alt="ImageMagick Logo"
93 style="width: 123px; height: 118px; border: 0px; float: right;" /></a>
94 <a href="../index.html">
95 <img src="../images/sprite.jpg"
96 alt="ImageMagick Sprite"
97 style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
100 <div class="westbar">
103 <a title="About ImageMagick" href="../index.html">About ImageMagick</a>
106 <a title="Binary Releases" href="binary-releases.html">Binary Releases</a>
109 <a title="Binary Release: Unix" href="binary-releases.html#unix">Unix</a>
112 <a title="Binary Release: MacOS X" href="binary-releases.html#macosx">Mac OS X</a>
115 <a title="Binary Release: iOS" href="binary-releases.html#iOS">iOS</a>
118 <a title="Binary Release: Windows" href="binary-releases.html#windows">Windows</a>
120 <div class="sep"></div>
122 <a title="Command-line Tools" href="command-line-tools.html">Command-line Tools</a>
125 <a title="Command-line Tools: Processing" href="command-line-processing.html">Processing</a>
128 <a title="Command-line Tools: Options" href="command-line-options.html">Options</a>
131 <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
134 <a title="Program Interfaces" href="api.html">Program Interfaces</a>
137 <a title="Program Interface: MagickWand" href="magick-wand.html">MagickWand</a>
140 <a title="Program Interface: MagickCore" href="magick-core.html">MagickCore</a>
143 <a title="Program Interface: PerlMagick" href="perl-magick.html">PerlMagick</a>
146 <a title="Program Interface: Magick++" href="magick++.html">Magick++</a>
148 <div class="sep"></div>
150 <a title="Install from Source" href="install-source.html">Install from Source</a>
153 <a title="Install from Source: Unix" href="install-source.html#unix">Unix</a>
156 <a title="Install from Source: Windows" href="install-source.html#windows">Windows</a>
159 <a title="Resources" href="resources.html">Resources</a>
162 <a title="Architecture" href="architecture.html">Architecture</a>
165 <a title="Download" href="download.html">Download</a>
167 <div class="sep"></div>
169 <a title="Search" href="search.html">Search</a>
171 <div class="sep"></div>
173 <a title="Site Map" href="sitemap.html">Site Map</a>
176 <a title="Site Map: Links" href="links.html">Links</a>
178 <div class="sep"></div>
180 <a title="Support ImageMagick Development" href="support.html">Support ImageMagick Development</a>
184 <div class="eastbar">
185 <script type="text/javascript">
188 var po = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
189 po.type = 'text/javascript';
191 po.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
192 var script = document.getElementsByTagName('offline-script')[0];
193 script.parentNode.insertBefore(po, script);
197 <div> <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.imagemagick.org/"></a></div>
199 <a href="http://flattr.com/thing/947300/Convert-Edit-And-Compose-Images" target="_blank">
200 <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" width="93" height="20" border="0" /></a>
202 <div class="g-plusone" id="gplusone"></div>
203 <script type="text/javascript">
210 var po = document.createElement('offline-script');
211 po.type = 'text/javascript';
213 po.src = 'https://127.0.0.1/js/plusone.js';
214 var script = document.getElementsByTagName('offline-script')[0];
215 script.parentNode.insertBefore(po, script);
217 var gplusone = document.getElementById("gplusone");
218 gplusone.setAttribute("data-size","medium");
219 gplusone.setAttribute("data-count","true");
226 <h1>ImageMagick Escapes</h1>
227 <p class="navigation-index"></p>
229 <div class="doc-section">
231 <p>Images in memory a lot of extra data assocated with them, beyond the actual
232 image data (cache) itself. This data can be very useful to users, either for
233 display, or for various calculations, or in modifying the behaviour of later
234 image processing operations.</p>
236 <p>Percent Escapes (of Image Propertes) are used in a number of options, for
237 example in <a href="command-line-options.html#format_identify_"
238 >-format</a> or in montage <a href="command-line-options.html#label"
239 >-label</a>, to print various properties and other settings associated with an
244 <td><b>Profile Data</b></td>
245 <td>Such as EXIF: data, containing focal lengths, exposures, dates, and in
246 come cases GPS locations.
249 <td><b>Attributes</b></td>
250 <td>These are directly involved with image data, and more commonly
251 modified as part of normal image processing. These include
252 width, height, depth, image type (colorspace), timing delays, and
253 background color. Most specific percent escapes is to access this
257 <td><b>Properties</b></td>
258 <td>These are stored as a table of free form strings, and are (if posible)
259 saved with the image (especially in MIFF and PNG image file formats).
260 These include: Labels, Captions, Comments.
263 <td><b>Artifacts</b></td>
264 <td>These are various operational (expert) settings that are saved for
265 use by various operators, or by the user for future use. It is just
266 a table of free-form strings. They are not saved with the image when
267 written. See Artifacts and Options below for details.
270 <td><b>Options</b></td>
271 <td>Also operational (expert) settings that are saved for
272 use by various operators, but are set globally for use by a whole
273 image list (also not saved). See Artifacts and Options below.
277 <h3>Percent Escape Handling</h3>
279 <p>If you request a percent escape such as <code>%[key]</code> the setting
280 is looked for in the following order until the first match has been
284 <li>Handle special prefixes such as 'artifact:' 'option:' 'exif:', or
285 'fx:'. This includes and calculations and or globs of those prefixes such
286 as 'exif:*' or 'artifact:*' (see below).</li>
288 <li>If <code>key</code> contains a glob pattern (but no known prefix)
289 search free-form properties table.</li>
291 <li>If <code>key</code> is a special image 'attribute' name (see list
292 above) return the associated or calculated image attribute.</li>
294 <li>Search for setting as a free-form 'property'</li>
295 <li>Search for setting as a free-form 'artifact'</li>
296 <li>Search for setting as a free-form 'option'</li>
298 <li>Replace escape with empty string, and perhaps produce a warning.</li>
301 <p>Remember, all long name forms of percent escapes are handled in a is case
302 insensitive manner. </p>
304 <p><b>As of IM v6.8.0-5</b> you can now access the Artifact and Option
305 free-form string tables directly, allowing you to override the above sequence,
306 and avoid accessing an attribute or property of the same name.</p>
309 %[artifact:<em class="arg">setting</em>]
310 %[option:<em class="arg">setting</em>]
314 <h3>Single Letter Attribute Percent Escapes</h3>
316 <p>Here are common single letter escapes (short form) is used to report the most
317 common attributes and properties of an image, such as: the image filename
318 filename, type, width, height. </p>
323 &lt; less-than character.
324 &gt; greater-than character.
325 &amp; ampersand character.
327 %b file size of image read in
328 %c comment meta-data property
329 %d directory component of path
330 %e filename extension or suffix
331 %f filename (including suffix)
332 %g layer canvas page geometry ( equiv to "%Wx%H%X%Y" )
333 %h current image height in pixels
334 %i image filename (note: becomes output filename for "info:")
335 %k CALCULATED: number of unique colors
336 %l label meta-data property
337 %m image file format (file magic)
338 %n number of images in current image sequence
339 %o output filename (used for delegates)
340 %p index of image in current image list
341 %q quantum depth (compile-time constant)
342 %r image class and colorspace
343 %s scene number (from input unless re-assigned)
344 %t filename without directory or extension (suffix)
345 %u unique temporary filename (used for delegates)
346 %w current width in pixels
347 %x x resolution (density)
348 %y y resolution (density)
349 %z image depth (as read in unless modified, image save depth)
350 %A image transparency channel enabled (true/false)
351 %C image compression type
352 %D image GIF dispose method
353 %G image size ( = %wx%h )
354 %H page (canvas) height
355 %M Magick filename (original file exactly as given, including read mods)
356 %O page (canvas) offset ( = %X%Y )
357 %P page (canvas) size ( = %Wx%H )
358 %Q image compression quality ( 0 = default )
360 %T image time delay (in centi-seconds)
361 %W page (canvas) width
362 %X page (canvas) x offset (including sign)
363 %Y page (canvas) y offset (including sign)
364 %Z unique filename (used for delegates)
365 %@ CALCULATED: trim bounding box (without actually trimming)
366 %# CALCULATED: 'signature' hash of image values
369 <p>Here is a sample command and its output for an image with filename
370 <code>bird.miff</code> and whose width is 512 and height is 480.</p>
372 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>identify -format "%m:%f %wx%h" bird.miff</span><span class='crtout'>MIFF:bird.miff 512x480</span></p>
373 <p>Note that all single letter percent escapes can also be used using long
374 form (from IM version 6.7.6-9, see next). For example <code>%[f]</code> is
375 equivelent to the <code>%f</code> short form. </p>
377 <p><b>WARNING</b> short form percent escapes are NOT performed when the percent
378 is after a number. For example.. <code>10%x10</code> will not expand the
379 <code>%x</code> as a percent escape. If you specifically want to expanded the
380 'x', use the long form which overrides this special case. EG:
381 <code>10%[x]10</code>. </p>
383 <p>Also be warned that calculated attributes can take some time to generate,
384 especially for large images.</p>
386 <h3>Long Form Attribute Percent Escapes</h3>
388 <p>In addition to the above specific and calculated attributes are recognized
389 when enclosed in braces (long form):</p>
392 %[base] base filename, no suffixes (as %t)
393 %[channels] ??? channels in use - colorspace ???
394 %[colorspace] Colorspace of Image Data (excluding transparency)
395 %[copyright] ImageMagick Copyright String
396 %[depth] depth of image for write (as input unless changed)
397 %[directory] directory part of filename (as %d)
398 %[extension] extention part of filename (as %e)
399 %[gamma] value of image gamma
400 %[group] ??? window group ???
401 %[height] original height of image (when it was read in)
402 %[kurtosis] CALCULATED: kurtosis statistic of image
403 %[magick] coder used to read image (not the file suffix)
404 %[max] CALCULATED: maximum value statistic of image
405 %[mean] CALCULATED: average value statistic of image
406 %[min] CALCULATED: minimum value statistic of image
407 %[name] The original name of the image
408 %[opaque] CALCULATED: is image fully-opaque?
409 %[page] Virtual canvas (page) geometry
410 %[resolution.y] X density (resolution) without units
411 %[resolution.x] Y density (resolution) without units
412 %[scene] original scene number of image in input file
413 %[size] original size of image (when it was read in)
414 %[skewness] CALCULATED: skewness statistic of image
415 %[standard-deviation] CALCULATED: standard-deviation statistic of image
416 %[type] CALCULATED: image type
417 %[unique] unique temporary filename ???
418 %[version] Version Information of this running ImageMagick
419 %[width] original width of image (when it was read in)
420 %[zero] zero (unique filename for delegate use)
425 <p>All other long forms of percent escapes (not single letter long form) are
426 handled in a case insensitive manner. Such escapes will will attempt to look
427 up that name specific data sources. </p>
429 <p>The primary search space (if not a specific attribute listed above) is
430 a free-form property string. Such strings are associated and saved with
431 images, and are typically set using either the <a href="command-line-options.html#set" >-set</a>
432 CLI option (or API equivelent), or from special convenience options
433 (such as <a href="command-line-options.html#label"
434 >-label</a>, <a href="command-line-options.html#comment"
435 >-comment</a>, <a href="command-line-options.html#caption"
438 These convenience options are globally saved (as 'global options' so thay can
439 be set before images are read), and later are transfered to the property of
440 individual images, only when they are read in. At that time any internal
441 percent escape present is then handled. </p>
443 To change a property of an image already in memory, you need to use <a
444 href="command-line-options.html#set" >-set</a>.
447 <p>Note that properties, like attributes (and profiles), are saved with
448 images when write, if the image file format allows. </p>
451 <h3>Artifacts and Options</h3>
453 <p>The previous percent escapes are associated with the primary Attributes and
454 Properties. Which is the original and primary focus of such percent escapes.
457 <p>However there are many operational settings that are used by various
458 ImageMagick operators that can be useful to set and later access. These
459 consist of per-image Artifacts, and Global options (associated with a list of
460 images, typically the current image list).
462 <p>Note that the major difference between an artifact and a property is that
463 artifacts, being an internal operational setting, is not saved with images (if
464 such is possible). </p>
466 <p>For example when you use <code>-define 'distort:viewport=100x100'</code> you
467 are in fact generating a global option, which the <a href="command-line-options.html#distort"
468 >-distort</a> operator will use to modify its behaviour (distorted output
471 <p>An Option is essentually a Artifact that has been stored globally as part
472 of a list of images (specifically a 'Wand' of images). As such they are
473 identical, in that a Option, is simply a global Artifact for all the
474 associated images. </p>
476 <p>As such you can use <code>-set 'option:distort:viewport' '100x100'</code> to
477 achieve the same result of setting a Artifact for the disort operation to use.
480 <p><b>Internal Handling of a Global Option...</b></p>
482 <p>The Core library ('MagickCore') does not generally directly understand
483 Global Options. As such, continuing the previous example, the
484 <code>DistortImages()</code> function only looks up an artifact to discover if
485 a 'viewport' has been provided to it. </p>
487 <p>How Global Options are used when a library function requests an Artifact is
488 one of the key differences between IMv6 and IMv7.
490 <p>In <b>ImageMagick version 6</b>... before each operator, any global Options
491 are copied to per-image Artifacts, for every image in the current image list.
492 This allows various operators to find its operational 'defines' or Artifacts.
495 <p>In <b>ImageMagick version 7</b>... sets a link back to the global options
496 data, so that if a specific per-image Artifact is not found , then it will
497 look for a equivelent global Option for that image list. directly. This
498 saves coping these free-form options into artifacts repeatally, and means you
499 can now separally define a global option for a list, and a individual
500 overriding artifact for a specific image in that list. </p>
502 <p>Note that many API's that do not use Wands (PerlMagick for example using
503 arrays of images rather than a Wand). In these API's you will not have Global
504 Options, only per-image Artifacts. </p>
506 <p>In summery a Global Option, if available, is equivelent to a per-image
510 <h3>Glob-Pattern Listing of Properties, Artifacts and Options</h3>
512 The <em class="arg">setting</em> can contain a glob pattern. As such you can
513 now list all free-form string properties, artifacts, and options, (but not
514 specific image attributes) using...
518 -print "__Properties__\n%[*]" \
519 -print "__Artifacts__\n%[artifact:*]" \
520 -print "__Options__\n%[option:*]" \
524 <!-- This does not format right!
525 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>convert ... \ </span><span class='crtout'> -print "__Properties__\n%[*]" \ </span><span class="crtprompt"> $ </span><span class='crtin'> -print "__Artifacts__\n%[artifact:*]" \ </span><span class='crtout'> -print "__Options__\n%[option:*]" \ </span><span class="crtprompt"> $ </span><span class='crtin'> ...</span></p>-->
527 <p> The format of glob patterns are very specific and as such is generally
528 only used to list specific settings, such as when debugging, rather than being
529 used for image processing use. </p>
532 <h3>Calculated Percent Escape Prefixes</h3>
534 There are some special prefixes (before the first ':') which performs
535 calculations based on the user provided string that follows that prefix. For
536 example you can do a numerical calculation use <code>%[fx:...]</code> to
537 evaluate the given <a href="fx.html">FX</a> expressions:</p>
540 %[fx:<em class="arg">expression</em>]
543 <p>Use <code>pixel:</code> to evaluate a pixel color as defined by the <a
544 href="fx.html">FX</a>
548 %[pixel:<em class="arg">expression</em>]
551 <h3>Specific Profile Percent Escape Prefixes</h3>
553 <p>You can also use the following special formatting syntax to print EXIF
554 mage meta-data that was included in the image read in:</p>
557 %[EXIF:<em class="arg">tag</em>]
560 <p>Choose <em class="arg">tag</em> from the following:</p>
563 * (print all EXIF tags, in keyword=data format)
564 ! (print all EXIF tags, in tag_number data format)
565 #hhhh (print data for EXIF tag #hhhh)
570 PhotometricInterpretation
590 PrimaryChromaticities
593 JPEGInterchangeFormat
594 JPEGInterchangeFormatLength
616 ComponentsConfiguration
617 CompressedBitsPerPixel
637 InteroperabilityOffset
639 SpatialFrequencyResponse
640 FocalPlaneXResolution
641 FocalPlaneYResolution
642 FocalPlaneResolutionUnit
650 <p>Surround the format specification with quotation marks to prevent your
651 shell from misinterpreting any spaces and square brackets.</p>
653 <p>The following special formatting syntax can be used to print IPTC
654 information contained in the file:</p>
657 %[IPTC:<em class="arg">dataset</em>:<em class="arg">record</em>]
660 <p>Select <em class="arg">dataset</em> and <em class="arg">record</em> from
668 1:22 File Format Version
669 1:30 Service Identifier
672 1:60 Envelope Priority
675 1:90 Coded Character Set
676 1:100 UNO (Unique Name of Object)
682 2:03 Object Type Reference
683 2:05 Object Name (Title)
685 2:08 Editorial Update
687 2:12 Subject Reference
689 2:20 Supplemental Category
690 2:22 Fixture Identifier
692 2:26 Content Location Code
693 2:27 Content Location Name
698 2:40 Special Instructions
700 2:45 Reference Service
702 2:50 Reference Number
705 2:62 Digital Creation Date
706 2:63 Digital Creation Time
707 2:65 Originating Program
710 2:80 By-Line (Author)
711 2:85 By-Line Title (Author Position) [Not used in Photoshop 7]
715 2:100 Country/Primary Location Code
716 2:101 Country/Primary Location Name
717 2:103 Original Transmission Reference
721 2:116 Copyright Notice
723 2:120 Caption/Abstract
724 2:122 Caption Writer/Editor
725 2:125 Rasterized Caption
727 2:131 Image Orientation
728 2:135 Language Identifier
730 2:151 Audio Sampling Rate
731 2:152 Audio Sampling Resolution
734 2:200 ObjectData Preview File Format
735 2:201 ObjectData Preview File Format Version
736 2:202 ObjectData Preview Data
738 Pre-ObjectData Descriptor Record
740 7:20 Max Subfile Size
741 7:90 ObjectData Size Announced
742 7:95 Maximum ObjectData Size
747 Post ObjectData Descriptor Record
748 9:10 Confirmed ObjectData Size
756 <span id="linkbar-west"> </span>
758 <span id="linkbar-center">
759 <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> •
760 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a> •
761 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
763 <span id="linkbar-east"> </span>
766 <span id="footer-west">© 1999-2013 ImageMagick Studio LLC</span>
767 <span id="footer-east"> <a href="contact.html">Contact the Wizards</a></span>
769 <div style="clear: both; margin: 0; width: 100%; "></div>