8 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
9 <title>ImageMagick: Format and Print Image Properties</title>
10 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
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-2015 ImageMagick Studio LLC"/>
23 <meta name="distribution" content="Global"/>
24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
25 <link rel="icon" href="../images/wand.png"/>
26 <link rel="shortcut icon" href="../images/wand.ico"/>
27 <link rel="stylesheet" href="../css/magick.html"/>
31 <div class="magick-masthead">
32 <div class="container">
33 <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle"
35 data-ad-client="ca-pub-3129977114552745"
36 data-ad-slot="6345125851"
37 data-ad-format="auto"></ins>
39 (adsbygoogle = window.adsbygoogle || []).push({});
41 <nav class="magick-nav">
42 <a class="magick-nav-item " href="../index.html">Home</a>
43 <a class="magick-nav-item " href="binary-releases.html">Download</a>
44 <a class="magick-nav-item " href="command-line-tools.html">Tools</a>
45 <a class="magick-nav-item " href="command-line-processing.html">Command-line</a>
46 <a class="magick-nav-item " href="resources.html">Resources</a>
47 <a class="magick-nav-item " href="api.html">Develop</a>
48 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
49 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
53 <div class="container">
54 <div class="magick-header">
55 <p class="lead magick-description">There are copious amounts of extra data associated with images (metadata), beyond the actual image pixels. This metadata can be useful, either for display, or for various calculations, or in modifying the behavior 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>
57 <div class="table-responsive">
58 <table class="table table-striped">
60 <td><b>Profile Data</b></td>
61 <td>Such as EXIF: data, containing focal lengths, exposures, dates, and in
62 come cases GPS locations.
65 <td><b>Attributes</b></td>
66 <td>These are directly involved with image data, and more commonly
67 modified as part of normal image processing. These include
68 width, height, depth, image type (colorspace), timing delays, and
69 background color. Most specific percent escapes is to access this
73 <td><b>Properties</b></td>
74 <td>These are stored as a table of free form strings, and are (if possible)
75 saved with the image (especially in MIFF and PNG image file formats).
76 These include: Labels, Captions, Comments.
79 <td><b>Artifacts</b></td>
80 <td>These are various operational (expert) settings that are saved for
81 use by various operators, or by the user for future use. It is just
82 a table of free-form strings. They are not saved with the image when
83 written. See Artifacts and Options below for details.
86 <td><b>Options</b></td>
87 <td>Also operational (expert) settings that are saved for
88 use by various operators, but are set globally for use by a whole
89 image list (also not saved). See Artifacts and Options below.
93 <h3 class="magick-header">Percent Escape Handling</h3>
95 <p>If you request a percent escape such as <code>%[key]</code> the setting
96 is looked for in the following order until the first match has been
100 <li>Handle special prefixes such as 'artifact:' 'option:' 'exif:', or
101 'fx:'. This includes and calculations and or globs of those prefixes such
102 as 'exif:*' or 'artifact:*' (see below).</li>
104 <li>If <code>key</code> contains a glob pattern (but no known prefix)
105 search free-form properties table.</li>
107 <li>If <code>key</code> is a special image 'attribute' name (see list
108 above) return the associated or calculated image attribute.</li>
110 <li>Search for setting as a free-form 'property'</li>
111 <li>Search for setting as a free-form 'artifact'</li>
112 <li>Search for setting as a free-form 'option'</li>
114 <li>Replace escape with empty string, and perhaps produce a warning.</li>
117 <p>Remember, all long name forms of percent escapes are handled in a is case
118 insensitive manner. </p>
120 <p><b>As of IM v6.8.0-5</b> you can now access the Artifact and Option
121 free-form string tables directly, allowing you to override the above sequence,
122 and avoid accessing an attribute or property of the same name.</p>
125 %[artifact:<var>setting</var>]
126 %[option:<var>setting</var>]
130 <h3 class="magick-header">Single Letter Attribute Percent Escapes</h3>
132 <p>Here are common single letter escapes (short form) is used to report the most
133 common attributes and properties of an image, such as: the image filename
134 filename, type, width, height. </p>
136 <div class="table-responsive">
137 <table class="table table-condensed table-striped">
144 <td>carriage return</td>
148 <td>less-than character.</td>
152 <td>greater-than character.</td>
156 <td>ampersand character.</td>
160 <td>a percent sign</td>
164 <td>file size of image read in</td>
168 <td>comment meta-data property</td>
172 <td>directory component of path</td>
176 <td>filename extension or suffix</td>
180 <td>filename (including suffix)</td>
184 <td>layer canvas page geometry (equivalent to "%Wx%H%X%Y")</td>
188 <td>current image height in pixels</td>
192 <td>image filename (note: becomes output filename for "info:")</td>
196 <td>CALCULATED: number of unique colors</td>
200 <td>label meta-data property</td>
204 <td>image file format (file magic)</td>
208 <td>number of images in current image sequence</td>
212 <td>output filename (used for delegates)</td>
216 <td>index of image in current image list</td>
220 <td>quantum depth (compile-time constant)</td>
224 <td>image class and colorspace</td>
228 <td>scene number (from input unless re-assigned)</td>
232 <td>filename without directory or extension (suffix)</td>
236 <td>unique temporary filename (used for delegates)</td>
240 <td>current width in pixels</td>
244 <td>x resolution (density)</td>
248 <td>y resolution (density)</td>
252 <td>image depth (as read in unless modified, image save depth)</td>
256 <td>image transparency channel enabled (true/false)</td>
260 <td>image compression type</td>
264 <td>image GIF dispose method</td>
268 <td>original image size (%wx%h; before any resizes)</td>
272 <td>page (canvas) height</td>
276 <td>Magick filename (original file exactly as given, including read mods)</td>
280 <td>page (canvas) offset ( = %X%Y )</td>
284 <td>page (canvas) size ( = %Wx%H )</td>
288 <td>image compression quality ( 0 = default )</td>
292 <td>?? scenes ??</td>
296 <td>image time delay (in centi-seconds)</td>
300 <td>image resolution units</td>
304 <td>page (canvas) width</td>
308 <td>page (canvas) x offset (including sign)</td>
312 <td>page (canvas) y offset (including sign)</td>
316 <td>unique filename (used for delegates)</td>
320 <td>CALCULATED: trim bounding box (without actually trimming)</td>
324 <td>CALCULATED: 'signature' hash of image values</td>
328 <p>Here is a sample command and its output for an image with filename
329 <code>bird.miff</code> and whose width is 512 and height is 480.</p>
332 -> identify -format "%m:%f %wx%h" bird.miff
333 MIFF:bird.miff 512x480
336 <p>Note that all single letter percent escapes can also be used using long
337 form (from IM version 6.7.6-9, see next). For example <code>%[f]</code> is
338 equivalent to the <code>%f</code> short form. </p>
340 <p><b>WARNING</b>: short form percent escapes are NOT performed when the percent
341 is after a number. For example, <code>10%x10</code> does not expand the
342 <code>%x</code> as a percent escape. If you specifically want to expand the
343 'x', use the long form which overrides this special case. EG:
344 <code>10%[x]10</code>. </p>
346 <p>Also be warned that calculated attributes can take some time to generate,
347 especially for large images.</p>
349 <h3 class="magick-header">Long Form Attribute Percent Escapes</h3>
351 <p>In addition to the above specific and calculated attributes are recognized
352 when enclosed in braces (long form):</p>
354 <div class="table-responsive">
355 <table class="table table-condensed table-striped">
358 <td>base filename, no suffixes (as %t)</td>
362 <td>??? channels in use - colorspace ???</td>
365 <td>%[colorspace]</td>
366 <td>Colorspace of Image Data (excluding transparency)</td>
369 <td>%[copyright]</td>
370 <td>ImageMagick Copyright String</td>
374 <td>depth of image for write (as input unless changed)</td>
377 <td>%[deskew:angle]</td>
378 <td>The deskew angle in degrees of rotation</td>
381 <td>%[directory]</td>
382 <td>directory part of filename (as %d)</td>
385 <td>%[distortion]</td>
386 <td>how well an image resembles a reference image (<a href="command-line-options.html#compare" >-compare</a>)</td>
390 <td>CALCULATED: entropy of the image</td>
393 <td>%[extension]</td>
394 <td>extension part of filename (as %e)</td>
398 <td>value of image gamma</td>
402 <td>??? window group ???</td>
406 <td>original height of image (when it was read in)</td>
410 <td>CALCULATED: kurtosis statistic of image</td>
414 <td>label meta-data property</td>
418 <td>coder used to read image (not the file suffix)</td>
422 <td>CALCULATED: maximum value statistic of image</td>
426 <td>CALCULATED: average value statistic of image</td>
430 <td>CALCULATED: minimum value statistic of image</td>
434 <td>The original name of the image</td>
438 <td>CALCULATED: is image fully-opaque?</td>
441 <td>%[orientation]</td>
442 <td>image orientation</td>
446 <td>Virtual canvas (page) geometry</td>
449 <td>%[profile:icc]</td>
450 <td>ICC profile info</td>
453 <td>%[profile:icm]</td>
454 <td>ICM profile info</td>
458 <td>list of any embedded profiles</td>
461 <td>%[resolution.x]</td>
462 <td>X density (resolution) without units</td>
465 <td>%[resolution.y]</td>
466 <td>Y density (resolution) without units</td>
470 <td>original scene number of image in input file</td>
474 <td>original size of image (when it was read in)</td>
478 <td>CALCULATED: skewness statistic of image</td>
481 <td>%[standard-deviation]</td>
482 <td>CALCULATED: standard deviation statistic of image</td>
486 <td>CALCULATED: image type</td>
490 <td>unique temporary filename ???</td>
494 <td>image resolution units</td>
498 <td>Version Information of this running ImageMagick</td>
502 <td>original width of image (when it was read in)</td>
506 <td>zero (unique filename for delegate use)</td>
510 <h3 class="magick-header">Properties</h3>
512 <p>All other long forms of percent escapes (not single letter long form) are
513 handled in a case insensitive manner. Such escapes will will attempt to look
514 up that name specific data sources. </p>
516 <p>The primary search space (if not a specific attribute listed above) is
517 a free-form property string. Such strings are associated and saved with
518 images, and are typically set using either the <a href="command-line-options.html#set" >-set</a>
519 CLI option (or API equivalent), or from special convenience options
520 (such as <a href="command-line-options.html#label"
521 >-label</a>, <a href="command-line-options.html#comment"
522 >-comment</a>, <a href="command-line-options.html#caption"
525 <p>These convenience options are globally saved (as 'global options' so thay can
526 be set before images are read), and later are transfered to the property of
527 individual images, only when they are read in. At that time any internal
528 percent escape present is then handled. </p>
530 <p>To change a property of an image already in memory, you need to use <a
531 href="command-line-options.html#set" >-set</a>.
534 <p>Note that properties, like attributes (and profiles), are saved with
535 images when write, if the image file format allows. </p>
538 <h3 class="magick-header">Artifacts and Options</h3>
540 <p>The previous percent escapes are associated with the primary Attributes and
541 Properties. Which is the original and primary focus of such percent escapes.
544 <p>However there are many operational settings that are used by various
545 ImageMagick operators that can be useful to set and later access. These
546 consist of per-image Artifacts, and Global options (associated with a list of
547 images, typically the current image list).</p>
549 <p>Note that the major difference between an artifact and a property is that
550 artifacts, being an internal operational setting, is not saved with images (if
551 such is possible). </p>
553 <p>For example when you use <code>-define 'distort:viewport=100x100'</code> you
554 are in fact generating a global option, which the <a href="command-line-options.html#distort"
555 >-distort</a> operator will use to modify its behavior (distorted output
558 <p>An Option is essentually a Artifact that has been stored globally as part
559 of a list of images (specifically a 'Wand' of images). As such they are
560 identical, in that a Option, is simply a global Artifact for all the
561 associated images. </p>
563 <p>As such you can use <code>-set 'option:distort:viewport' '100x100'</code> to
564 achieve the same result of setting a Artifact for the disort operation to use.
567 <p><b>Internal Handling of a Global Option...</b></p>
569 <p>The Core library ('MagickCore') does not generally directly understand
570 Global Options. As such, continuing the previous example, the
571 <code>DistortImages()</code> function only looks up an artifact to discover if
572 a 'viewport' has been provided to it. </p>
574 <p>How Global Options are used when a library function requests an Artifact is
575 one of the key differences between IMv6 and IMv7.</p>
577 <p>In <b>ImageMagick version 6</b>... before each operator, any global Options
578 are copied to per-image Artifacts, for every image in the current image list.
579 This allows various operators to find its operational 'defines' or Artifacts.
582 <p>In <b>ImageMagick version 7</b>... sets a link back to the global options
583 data, so that if a specific per-image Artifact is not found , then it will
584 look for a equivalent global Option for that image list. directly. This
585 saves coping these free-form options into artifacts repeatally, and means you
586 can now separately define a global option for a list, and a individual
587 overriding artifact for a specific image in that list. </p>
589 <p>Note that many API's that do not use Wands (PerlMagick for example using
590 arrays of images rather than a Wand). In these API's you will not have Global
591 Options, only per-image Artifacts. </p>
593 <p>In summery a Global Option, if available, is equivalent to a per-image
597 <h3 class="magick-header">Glob-Pattern Listing of Properties, Artifacts and Options</h3>
599 <p>The <var>setting</var> can contain a glob pattern. As such you can
600 now list all free-form string properties, artifacts, and options, (but not
601 specific image attributes) using...</p>
605 -print "__Properties__\n%[*]" \
606 -print "__Artifacts__\n%[artifact:*]" \
607 -print "__Options__\n%[option:*]" \
611 <p> The format of glob patterns are very specific and as such is generally
612 only used to list specific settings, such as when debugging, rather than being
613 used for image processing use. </p>
616 <h3 class="magick-header">Calculated Percent Escape Prefixes</h3>
618 <p>There are some special prefixes (before the first ':') which performs
619 calculations based on the user provided string that follows that prefix. For
620 example you can do a numerical calculation use <code>%[fx:...]</code> to
621 evaluate the given <a href="fx.html">FX</a> expressions:</p>
624 %[fx:<var>expression</var>]
627 <p>Use <code>pixel:</code> to evaluate a pixel color as defined by the <a
628 href="fx.html">FX</a>
632 %[pixel:<var>expression</var>]
635 <h3 class="magick-header">Specific Profile Percent Escape Prefixes</h3>
637 <p>You can also use the following special formatting syntax to print EXIF
638 mage meta-data that was included in the image read in:</p>
641 %[EXIF:<var>tag</var>]
644 <p>Choose <var>tag</var> from the following:</p>
646 <pre class="pre-scrollable">
647 * (print all EXIF tags, in keyword=data format)
648 ! (print all EXIF tags, in tag_number data format)
649 #hhhh (print data for EXIF tag #hhhh)
654 PhotometricInterpretation
674 PrimaryChromaticities
677 JPEGInterchangeFormat
678 JPEGInterchangeFormatLength
700 ComponentsConfiguration
701 CompressedBitsPerPixel
721 InteroperabilityOffset
723 SpatialFrequencyResponse
724 FocalPlaneXResolution
725 FocalPlaneYResolution
726 FocalPlaneResolutionUnit
734 <p>Surround the format specification with quotation marks to prevent your
735 shell from misinterpreting any spaces and square brackets.</p>
737 <p>The following special formatting syntax can be used to print IPTC
738 information contained in the file:</p>
741 %[IPTC:<var>dataset</var>:<var>record</var>]
744 <p>Select <var>dataset</var> and <var>record</var> from the following:</p>
746 <pre class="pre-scrollable:">
751 1:22 File Format Version
752 1:30 Service Identifier
755 1:60 Envelope Priority
758 1:90 Coded Character Set
759 1:100 UNO (Unique Name of Object)
765 2:03 Object Type Reference
766 2:05 Object Name (Title)
768 2:08 Editorial Update
770 2:12 Subject Reference
772 2:20 Supplemental Category
773 2:22 Fixture Identifier
775 2:26 Content Location Code
776 2:27 Content Location Name
781 2:40 Special Instructions
783 2:45 Reference Service
785 2:50 Reference Number
788 2:62 Digital Creation Date
789 2:63 Digital Creation Time
790 2:65 Originating Program
793 2:80 By-Line (Author)
794 2:85 By-Line Title (Author Position) [Not used in Photoshop 7]
798 2:100 Country/Primary Location Code
799 2:101 Country/Primary Location Name
800 2:103 Original Transmission Reference
804 2:116 Copyright Notice
806 2:120 Caption/Abstract
807 2:122 Caption Writer/Editor
808 2:125 Rasterized Caption
810 2:131 Image Orientation
811 2:135 Language Identifier
813 2:151 Audio Sampling Rate
814 2:152 Audio Sampling Resolution
817 2:200 ObjectData Preview File Format
818 2:201 ObjectData Preview File Format Version
819 2:202 ObjectData Preview Data
821 Pre-ObjectData Descriptor Record
823 7:20 Max Subfile Size
824 7:90 ObjectData Size Announced
825 7:95 Maximum ObjectData Size
830 Post ObjectData Descriptor Record
831 9:10 Confirmed ObjectData Size
834 <footer class="magick-footer">
835 <p><a href="support.html">Donate</a> •
836 <a href="sitemap.html">Sitemap</a> •
837 <a href="links.html">Related</a> •
838 <a href="architecture.html">Architecture</a>
840 <p><a href="escape.html#">Back to top</a> •
841 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> •
842 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
843 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
845 </div><!-- /.container -->
847 <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
848 <script src="http://nextgen.imagemagick.org/js/magick.html"></script>