1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 <title>ImageMagick: Format and Print Image Properties</title>
8 <meta http-equiv="content-language" content="en-US">
9 <meta http-equiv="content-type" content="text/html; charset=utf-8">
10 <meta http-equiv="reply-to" content="magick-users@imagemagick.org">
11 <meta name="application-name" content="ImageMagick">
12 <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.">
13 <meta name="application-url" content="http://www.imagemagick.org">
14 <meta name="generator" content="PHP">
15 <meta name="keywords" content="format, print, image, properties, 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-2012 ImageMagick Studio LLC">
23 <meta name="distribution" content="Global">
24 <link rel="icon" href="../images/wand.png">
25 <link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon">
26 <link rel="stylesheet" href="www/css/bootstrap.min.css">
27 <link rel="stylesheet" href="www/css/magick.css">
32 <div class="magick-masthead">
33 <div class="container">
34 <script type="text/javascript">
36 google_ad_client = "pub-3129977114552745";
37 google_ad_slot = "5439289906";
38 google_ad_width = 728;
39 google_ad_height = 90;
42 <center><script type="text/javascript" src="http://localhost/pagead/show_ads.js">
44 <nav class="magick-nav">
45 <a class="magick-nav-item " href="http://www.imagemagick.org/ImageMagick-7.0.0/index.html">Home</a>
46 <a class="magick-nav-item " href="binary-releases.html">Downloads</a>
47 <a class="magick-nav-item " href="command-line-tools.html">Tools</a>
48 <a class="magick-nav-item " href="command-line-options.html">Options</a>
49 <a class="magick-nav-item " href="api.html">Development</a>
50 <a class="magick-nav-item" href="../discourse-server">Community</a>
51 <a class="magick-nav-item navbar-right " href="search.html">Search</a>
55 <div class="container">
56 <div class="magick-header">
57 <p class="lead magick-description">There are copious amounts of extra data assocated with images (metadata), beyond the actual image pixels. This metadata can be useful, either for display, or for various calculations, or in modifying the behaviour of later image processing operations. You can utilize percent escapes in a number of options, for example in <a href="command-line-options.html#format_identify_">-format</a> or in montage <a href="command-line-options.html#label">-label</a>, to print various properties and other settings associated with an image.</p>
59 <div class="table-responsive">
60 <table class="table table-striped">
62 <td><b>Profile Data</b></td>
63 <td>Such as EXIF: data, containing focal lengths, exposures, dates, and in
64 come cases GPS locations.
67 <td><b>Attributes</b></td>
68 <td>These are directly involved with image data, and more commonly
69 modified as part of normal image processing. These include
70 width, height, depth, image type (colorspace), timing delays, and
71 background color. Most specific percent escapes is to access this
75 <td><b>Properties</b></td>
76 <td>These are stored as a table of free form strings, and are (if posible)
77 saved with the image (especially in MIFF and PNG image file formats).
78 These include: Labels, Captions, Comments.
81 <td><b>Artifacts</b></td>
82 <td>These are various operational (expert) settings that are saved for
83 use by various operators, or by the user for future use. It is just
84 a table of free-form strings. They are not saved with the image when
85 written. See Artifacts and Options below for details.
88 <td><b>Options</b></td>
89 <td>Also operational (expert) settings that are saved for
90 use by various operators, but are set globally for use by a whole
91 image list (also not saved). See Artifacts and Options below.
95 <h3 class="magick-header">Percent Escape Handling</h3>
97 <p>If you request a percent escape such as <code>%[key]</code> the setting
98 is looked for in the following order until the first match has been
102 <li>Handle special prefixes such as 'artifact:' 'option:' 'exif:', or
103 'fx:'. This includes and calculations and or globs of those prefixes such
104 as 'exif:*' or 'artifact:*' (see below).</li>
106 <li>If <code>key</code> contains a glob pattern (but no known prefix)
107 search free-form properties table.</li>
109 <li>If <code>key</code> is a special image 'attribute' name (see list
110 above) return the associated or calculated image attribute.</li>
112 <li>Search for setting as a free-form 'property'</li>
113 <li>Search for setting as a free-form 'artifact'</li>
114 <li>Search for setting as a free-form 'option'</li>
116 <li>Replace escape with empty string, and perhaps produce a warning.</li>
119 <p>Remember, all long name forms of percent escapes are handled in a is case
120 insensitive manner. </p>
122 <p><b>As of IM v6.8.0-5</b> you can now access the Artifact and Option
123 free-form string tables directly, allowing you to override the above sequence,
124 and avoid accessing an attribute or property of the same name.</p>
127 %[artifact:<var>setting</var>]
128 %[option:<var>setting</var>]
132 <h3 class="magick-header">Single Letter Attribute Percent Escapes</h3>
134 <p>Here are common single letter escapes (short form) is used to report the most
135 common attributes and properties of an image, such as: the image filename
136 filename, type, width, height. </p>
138 <div class="table-responsive">
139 <table class="table table-condensed table-striped">
146 <td>carriage return</td>
150 <td>less-than character.</td>
154 <td>greater-than character.</td>
158 <td>ampersand character.</td>
162 <td>a percent sign</td>
166 <td>file size of image read in</td>
170 <td>comment meta-data property</td>
174 <td>directory component of path</td>
178 <td>filename extension or suffix</td>
182 <td>filename (including suffix)</td>
186 <td>layer canvas page geometry (equivalent to "%Wx%H%X%Y")</td>
190 <td>current image height in pixels</td>
194 <td>image filename (note: becomes output filename for "info:")</td>
198 <td>CALCULATED: number of unique colors</td>
202 <td>label meta-data property</td>
206 <td>image file format (file magic)</td>
210 <td>number of images in current image sequence</td>
214 <td>output filename (used for delegates)</td>
218 <td>index of image in current image list</td>
222 <td>quantum depth (compile-time constant)</td>
226 <td>image class and colorspace</td>
230 <td>scene number (from input unless re-assigned)</td>
234 <td>filename without directory or extension (suffix)</td>
238 <td>unique temporary filename (used for delegates)</td>
242 <td>current width in pixels</td>
246 <td>x resolution (density)</td>
250 <td>y resolution (density)</td>
254 <td>image depth (as read in unless modified, image save depth)</td>
258 <td>image transparency channel enabled (true/false)</td>
262 <td>image compression type</td>
266 <td>image GIF dispose method</td>
270 <td>original image size (%wx%h; before any resizes)</td>
274 <td>page (canvas) height</td>
278 <td>Magick filename (original file exactly as given, including read mods)</td>
282 <td>page (canvas) offset ( = %X%Y )</td>
286 <td>page (canvas) size ( = %Wx%H )</td>
290 <td>image compression quality ( 0 = default )</td>
294 <td>?? scenes ??</td>
298 <td>image time delay (in centi-seconds)</td>
302 <td>image resolution units</td>
306 <td>page (canvas) width</td>
310 <td>page (canvas) x offset (including sign)</td>
314 <td>page (canvas) y offset (including sign)</td>
318 <td>unique filename (used for delegates)</td>
322 <td>CALCULATED: trim bounding box (without actually trimming)</td>
326 <td>CALCULATED: 'signature' hash of image values</td>
330 <p>Here is a sample command and its output for an image with filename
331 <code>bird.miff</code> and whose width is 512 and height is 480.</p>
334 -> identify -format "%m:%f %wx%h" bird.miff
335 MIFF:bird.miff 512x480
338 <p>Note that all single letter percent escapes can also be used using long
339 form (from IM version 6.7.6-9, see next). For example <code>%[f]</code> is
340 equivelent to the <code>%f</code> short form. </p>
342 <p><b>WARNING</b>: short form percent escapes are NOT performed when the percent
343 is after a number. For example, <code>10%x10</code> does not expand the
344 <code>%x</code> as a percent escape. If you specifically want to expand the
345 'x', use the long form which overrides this special case. EG:
346 <code>10%[x]10</code>. </p>
348 <p>Also be warned that calculated attributes can take some time to generate,
349 especially for large images.</p>
351 <h3 class="magick-header">Long Form Attribute Percent Escapes</h3>
353 <p>In addition to the above specific and calculated attributes are recognized
354 when enclosed in braces (long form):</p>
356 <div class="table-responsive">
357 <table class="table table-condensed table-striped">
360 <td>base filename, no suffixes (as %t)</td>
364 <td>??? channels in use - colorspace ???</td>
367 <td>%[colorspace]</td>
368 <td>Colorspace of Image Data (excluding transparency)</td>
371 <td>%[copyright]</td>
372 <td>ImageMagick Copyright String</td>
376 <td>depth of image for write (as input unless changed)</td>
379 <td>%[deskew:angle]</td>
380 <td>The deskew angle in degrees of rotation</td>
383 <td>%[directory]</td>
384 <td>directory part of filename (as %d)</td>
387 <td>%[distortion]</td>
388 <td>how well an image resembles a reference image (<a href="command-line-options.html#compare">-compare</a>)</td>
392 <td>CALCULATED: entropy of the image</td>
395 <td>%[extension]</td>
396 <td>extention part of filename (as %e)</td>
400 <td>value of image gamma</td>
404 <td>??? window group ???</td>
408 <td>original height of image (when it was read in)</td>
412 <td>CALCULATED: kurtosis statistic of image</td>
416 <td>label meta-data property</td>
420 <td>coder used to read image (not the file suffix)</td>
424 <td>CALCULATED: maximum value statistic of image</td>
428 <td>CALCULATED: average value statistic of image</td>
432 <td>CALCULATED: minimum value statistic of image</td>
436 <td>The original name of the image</td>
440 <td>CALCULATED: is image fully-opaque?</td>
443 <td>%[orientation]</td>
444 <td>image orientation</td>
448 <td>Virtual canvas (page) geometry</td>
451 <td>%[profile:icc]</td>
452 <td>ICC profile info</td>
455 <td>%[profile:icm]</td>
456 <td>ICM profile info</td>
460 <td>list of any embedded profiles</td>
463 <td>%[resolution.x]</td>
464 <td>X density (resolution) without units</td>
467 <td>%[resolution.y]</td>
468 <td>Y density (resolution) without units</td>
472 <td>original scene number of image in input file</td>
476 <td>original size of image (when it was read in)</td>
480 <td>CALCULATED: skewness statistic of image</td>
483 <td>%[standard-deviation]</td>
484 <td>CALCULATED: standard deviation statistic of image</td>
488 <td>CALCULATED: image type</td>
492 <td>unique temporary filename ???</td>
496 <td>image resolution units</td>
500 <td>Version Information of this running ImageMagick</td>
504 <td>original width of image (when it was read in)</td>
508 <td>zero (unique filename for delegate use)</td>
512 <h3 class="magick-header">Properties</h3>
514 <p>All other long forms of percent escapes (not single letter long form) are
515 handled in a case insensitive manner. Such escapes will will attempt to look
516 up that name specific data sources. </p>
518 <p>The primary search space (if not a specific attribute listed above) is
519 a free-form property string. Such strings are associated and saved with
520 images, and are typically set using either the <a href="command-line-options.html#set">-set</a>
521 CLI option (or API equivelent), or from special convenience options
522 (such as <a href="command-line-options.html#label">-label</a>, <a href="command-line-options.html#comment">-comment</a>, <a href="command-line-options.html#caption">-caption</a>). </p>
524 <p>These convenience options are globally saved (as 'global options' so thay can
525 be set before images are read), and later are transfered to the property of
526 individual images, only when they are read in. At that time any internal
527 percent escape present is then handled. </p>
529 <p>To change a property of an image already in memory, you need to use <a href="command-line-options.html#set">-set</a>.
532 <p>Note that properties, like attributes (and profiles), are saved with
533 images when write, if the image file format allows. </p>
536 <h3 class="magick-header">Artifacts and Options</h3>
538 <p>The previous percent escapes are associated with the primary Attributes and
539 Properties. Which is the original and primary focus of such percent escapes.
542 <p>However there are many operational settings that are used by various
543 ImageMagick operators that can be useful to set and later access. These
544 consist of per-image Artifacts, and Global options (associated with a list of
545 images, typically the current image list).</p>
547 <p>Note that the major difference between an artifact and a property is that
548 artifacts, being an internal operational setting, is not saved with images (if
549 such is possible). </p>
551 <p>For example when you use <code>-define 'distort:viewport=100x100'</code> you
552 are in fact generating a global option, which the <a href="command-line-options.html#distort">-distort</a> operator will use to modify its behaviour (distorted output
555 <p>An Option is essentually a Artifact that has been stored globally as part
556 of a list of images (specifically a 'Wand' of images). As such they are
557 identical, in that a Option, is simply a global Artifact for all the
558 associated images. </p>
560 <p>As such you can use <code>-set 'option:distort:viewport' '100x100'</code> to
561 achieve the same result of setting a Artifact for the disort operation to use.
564 <p><b>Internal Handling of a Global Option...</b></p>
566 <p>The Core library ('MagickCore') does not generally directly understand
567 Global Options. As such, continuing the previous example, the
568 <code>DistortImages()</code> function only looks up an artifact to discover if
569 a 'viewport' has been provided to it. </p>
571 <p>How Global Options are used when a library function requests an Artifact is
572 one of the key differences between IMv6 and IMv7.</p>
574 <p>In <b>ImageMagick version 6</b>... before each operator, any global Options
575 are copied to per-image Artifacts, for every image in the current image list.
576 This allows various operators to find its operational 'defines' or Artifacts.
579 <p>In <b>ImageMagick version 7</b>... sets a link back to the global options
580 data, so that if a specific per-image Artifact is not found , then it will
581 look for a equivelent global Option for that image list. directly. This
582 saves coping these free-form options into artifacts repeatally, and means you
583 can now separally define a global option for a list, and a individual
584 overriding artifact for a specific image in that list. </p>
586 <p>Note that many API's that do not use Wands (PerlMagick for example using
587 arrays of images rather than a Wand). In these API's you will not have Global
588 Options, only per-image Artifacts. </p>
590 <p>In summery a Global Option, if available, is equivelent to a per-image
594 <h3 class="magick-header">Glob-Pattern Listing of Properties, Artifacts and Options</h3>
596 <p>The <var>setting</var> can contain a glob pattern. As such you can
597 now list all free-form string properties, artifacts, and options, (but not
598 specific image attributes) using...</p>
602 -print "__Properties__\n%[*]" \
603 -print "__Artifacts__\n%[artifact:*]" \
604 -print "__Options__\n%[option:*]" \
608 <p> The format of glob patterns are very specific and as such is generally
609 only used to list specific settings, such as when debugging, rather than being
610 used for image processing use. </p>
613 <h3 class="magick-header">Calculated Percent Escape Prefixes</h3>
615 <p>There are some special prefixes (before the first ':') which performs
616 calculations based on the user provided string that follows that prefix. For
617 example you can do a numerical calculation use <code>%[fx:...]</code> to
618 evaluate the given <a href="fx.html">FX</a> expressions:</p>
621 %[fx:<var>expression</var>]
624 <p>Use <code>pixel:</code> to evaluate a pixel color as defined by the <a href="fx.html">FX</a>
628 %[pixel:<var>expression</var>]
631 <h3 class="magick-header">Specific Profile Percent Escape Prefixes</h3>
633 <p>You can also use the following special formatting syntax to print EXIF
634 mage meta-data that was included in the image read in:</p>
637 %[EXIF:<var>tag</var>]
640 <p>Choose <var>tag</var> from the following:</p>
642 <pre class="pre-scrollable">
643 * (print all EXIF tags, in keyword=data format)
644 ! (print all EXIF tags, in tag_number data format)
645 #hhhh (print data for EXIF tag #hhhh)
650 PhotometricInterpretation
670 PrimaryChromaticities
673 JPEGInterchangeFormat
674 JPEGInterchangeFormatLength
696 ComponentsConfiguration
697 CompressedBitsPerPixel
717 InteroperabilityOffset
719 SpatialFrequencyResponse
720 FocalPlaneXResolution
721 FocalPlaneYResolution
722 FocalPlaneResolutionUnit
730 <p>Surround the format specification with quotation marks to prevent your
731 shell from misinterpreting any spaces and square brackets.</p>
733 <p>The following special formatting syntax can be used to print IPTC
734 information contained in the file:</p>
737 %[IPTC:<var>dataset</var>:<var>record</var>]
740 <p>Select <var>dataset</var> and <var>record</var> from the following:</p>
742 <pre class="pre-scrollable:">
747 1:22 File Format Version
748 1:30 Service Identifier
751 1:60 Envelope Priority
754 1:90 Coded Character Set
755 1:100 UNO (Unique Name of Object)
761 2:03 Object Type Reference
762 2:05 Object Name (Title)
764 2:08 Editorial Update
766 2:12 Subject Reference
768 2:20 Supplemental Category
769 2:22 Fixture Identifier
771 2:26 Content Location Code
772 2:27 Content Location Name
777 2:40 Special Instructions
779 2:45 Reference Service
781 2:50 Reference Number
784 2:62 Digital Creation Date
785 2:63 Digital Creation Time
786 2:65 Originating Program
789 2:80 By-Line (Author)
790 2:85 By-Line Title (Author Position) [Not used in Photoshop 7]
794 2:100 Country/Primary Location Code
795 2:101 Country/Primary Location Name
796 2:103 Original Transmission Reference
800 2:116 Copyright Notice
802 2:120 Caption/Abstract
803 2:122 Caption Writer/Editor
804 2:125 Rasterized Caption
806 2:131 Image Orientation
807 2:135 Language Identifier
809 2:151 Audio Sampling Rate
810 2:152 Audio Sampling Resolution
813 2:200 ObjectData Preview File Format
814 2:201 ObjectData Preview File Format Version
815 2:202 ObjectData Preview Data
817 Pre-ObjectData Descriptor Record
819 7:20 Max Subfile Size
820 7:90 ObjectData Size Announced
821 7:95 Maximum ObjectData Size
826 Post ObjectData Descriptor Record
827 9:10 Confirmed ObjectData Size
830 <footer class="magick-footer">
831 <div class="magick-nav-item navbar-left">
832 <a href="support.html">Donations</a>
834 <div class="magick-nav-item navbar-right">
835 <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.imagemagick.org/"></a>
837 <a href="http://flattr.com/thing/947300/Convert-Edit-And-Compose-Images" target="_blank">
838 <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0"></a>
841 <p><a href="sitemap.html">Sitemap</a> •
842 <a href="links.html">Related</a> •
843 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a> •
844 <a href="http://jqmagick.imagemagick.org/">JqMagick</a> •
845 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a>
847 <p><a href="escape.html#">Back to top</a> •
848 <a href="contact.html">Contact Us</a></p>
850 </div><!-- /.container -->
852 <script src="https://localhost/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
853 <script src="../js/bootstrap.min.js"></script>
854 <script type="text/javascript">
857 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
858 s.type = 'text/javascript';
860 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
861 t.parentNode.insertBefore(s, t);