]> granicus.if.org Git - imagemagick/blob - www/perl-magick.html
(no commit message)
[imagemagick] / www / perl-magick.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" \r
2   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html version="-//W3C//DTD XHTML 1.1//EN"\r
4       xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"\r
5       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
6       xsi:schemaLocation="http://www.w3.org/1999/xhtml\r
7                           http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">\r
8 <head>\r
9   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>\r
10   <meta name="google-site-verification" content="MxsMq6bdLOx0KSuz1MY6yG9ZTIJ7_7DVRfl5NCAT5Yg"/>\r
11   <title>ImageMagick: PerlMagick, Perl API for ImageMagick</title>
12   <meta http-equiv="content-language" content="en-US"/>
13   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
14   <meta http-equiv="reply-to" content="magick-users@imagemagick.org"/>
15   <meta name="application-name" content="ImageMagick"/>
16   <meta name="description" content="Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats.  In addition resize, rotate, shear, distort and transform images automagically."/>
17   <meta name="application-url" content="http://www.imagemagick.org"/>
18   <meta name="generator" content="PHP"/>
19   <meta name="keywords" content="perlmagick, perl, api, for, imagemagick, ImageMagick, PerlMagick, image processing, OpenMP, software development library, image, photo, software, Magick++, MagickWand"/>
20   <meta name="rating" content="GENERAL"/>
21   <meta name="robots" content="INDEX, FOLLOW"/>
22   <meta name="generator" content="ImageMagick Studio LLC"/>
23   <meta name="author" content="ImageMagick Studio LLC"/>
24   <meta name="revisit-after" content="2 DAYS"/>
25   <meta name="resource-type" content="document"/>
26   <meta name="copyright" content="Copyright (c) 1999-2012 ImageMagick Studio LLC"/>
27   <meta name="distribution" content="Global"/>
28   <link rel="icon" href="../images/wand.png"/>
29   <link rel="shortcut icon" href="../images/wand.ico"  type="images/x-icon"/>
30   <link rel="canonical" href="http://www.imagemagick.org" />\r
31   <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>\r
32   <!-- Add jQuery library -->\r
33   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>\r
34   \r
35   <!-- Optionaly include easing and/or mousewheel plugins -->\r
36   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/jquery.easing-1.3.pack.js"></script>\r
37   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/jquery.mousewheel-3.0.6.pack.js"></script>\r
38   \r
39   <!-- Add fancyBox -->\r
40   <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/jquery.fancybox.css?v=2.0.4" type="text/css" media="screen" />\r
41   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/jquery.fancybox.pack.js?v=2.0.4"></script>\r
42   \r
43   <!-- Optionaly include button and/or thumbnail helpers -->\r
44   <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/helpers/jquery.fancybox-buttons.css?v=2.0.4" type="text/css" media="screen" />\r
45   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/helpers/jquery.fancybox-buttons.js?v=2.0.4"></script>\r
46   \r
47   <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/helpers/jquery.fancybox-thumbs.css?v=2.0.4" type="text/css" media="screen" />\r
48   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/helpers/jquery.fancybox-thumbs.js?v=2.0.4"></script>\r
49   <script type="text/javascript">\r
50         $(document).ready(function() {\r
51                 $(".fancybox").fancybox();\r
52         });\r
53   </script>\r
54   <!-- ImageMagick style -->\r
55   <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />\r
56   <style type="text/css" media="all">\r
57     @import url("../www/magick.css");\r
58   </style>\r
59 </head>\r
60 \r
61 <body id="www-imagemagick-org">\r
62 <div class="titlebar">\r
63 <div style="margin: 17px auto; float: left;">\r
64   <script type="text/javascript">\r
65   <!--\r
66     google_ad_client = "pub-3129977114552745";\r
67     google_ad_slot = "5439289906";\r
68     google_ad_width = 728;\r
69     google_ad_height = 90;\r
70   //-->\r
71   </script>\r
72   <script type="text/javascript"\r
73     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\r
74   </script>\r
75 </div>\r
76 <a href="../discourse-server">\r
77   <img src="../images/logo.jpg"\r
78   alt="ImageMagick Logo"\r
79   style="width: 123px; height: 118px; border: 0px; float: right;" /></a>\r
80 <a href="../index.html">\r
81   <img src="../images/sprite.jpg"\r
82   alt="ImageMagick Sprite"\r
83   style="width: 114px; height: 118px; border: 0px; float: right;" /></a>\r
84 </div>\r
85 \r
86 <div class="westbar">\r
87 \r
88 <div class="menu">
89   <a title="About ImageMagick" href="../index.html">About ImageMagick</a>
90 </div>
91 <div class="menu">
92   <a title="Binary Releases" href="binary-releases.html">Binary Releases</a>
93 </div>
94 <div class="sub">
95     <a title="Binary Release: Unix" href="binary-releases.html#unix">Unix</a>
96 </div>
97 <div class="sub">
98     <a title="Binary Release: MacOS X" href="binary-releases.html#macosx">Mac OS X</a>
99 </div>
100 <div class="sub">
101     <a title="Binary Release: iOS" href="binary-releases.html#iOS">iOS</a>
102 </div>
103 <div class="sub">
104     <a title="Binary Release: Windows" href="binary-releases.html#windows">Windows</a>
105 </div>
106 <div class="sep"></div>\r
107 <div class="menu">
108   <a title="Command-line Tools" href="command-line-tools.html">Command-line Tools</a>
109 </div>
110 <div class="sub">
111     <a title="Command-line Tools: Processing" href="command-line-processing.html">Processing</a>
112 </div>
113 <div class="sub">
114     <a title="Command-line Tools: Options" href="command-line-options.html">Options</a>
115 </div>
116 <div class="sub">
117     <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
118 </div>
119 <div class="menu">
120   <a title="Program Interfaces" href="api.html">Program Interfaces</a>
121 </div>
122 <div class="sub">
123     <a title="Program Interface: MagickWand" href="magick-wand.html">MagickWand</a>
124 </div>
125 <div class="sub">
126     <a title="Program Interface: MagickCore" href="magick-core.html">MagickCore</a>
127 </div>
128 <div class="sub">
129     <a title="Program Interface: PerlMagick" href="perl-magick.html">PerlMagick</a>
130 </div>
131 <div class="sub">
132     <a title="Program Interface: Magick++" href="magick++.html">Magick++</a>
133 </div>
134 <div class="sep"></div>\r
135 <div  class="menu">
136    <a title="Install from Source" href="install-source.html">Install from Source</a>
137 </div>
138 <div class="sub">
139     <a title="Install from Source: Unix" href="install-source.html#unix">Unix</a>
140 </div>
141 <div class="sub">
142     <a title="Install from Source: Windows" href="install-source.html#windows">Windows</a>
143  </div>
144 <div class="menu">
145   <a title="Resources" href="resources.html">Resources</a>
146 </div>
147 <div class="menu">
148   <a title="Architecture" href="architecture.html">Architecture</a>
149 </div>
150 <div class="menu">
151   <a title="Download" href="download.html">Download</a>
152 </div>
153 <div class="sep"></div>\r
154 <div class="menu">
155   <a title="Search" href="search.html">Search</a>
156 </div>
157 <div class="sep"></div>\r
158 <div class="menu">
159   <a title="Site Map" href="sitemap.html">Site Map</a>
160 </div>
161 <div  class="sub">
162   <a title="Site Map: Links" href="links.html">Links</a>
163 </div>
164 <div class="sep"></div>\r
165 <div class="menu">
166   <a rel="follow" title="Sponsors" href="sponsors.html">Sponsors:</a>
167
168   <a href="http://www.networkredux.com"> <img src="../images/networkredux.png" width="140" height="31" alt="[sponsor]" style="margin-top: 4px; margin-left: 4px; border: 0px; float: left;" /></a>
169   <a href="http://www.dinodirect.com/ipads-tablets/"> <img src="../images/dino-direct.jpg" width="140" height="90" alt="[sponsor]" style="margin-top: 4px; margin-left: 4px; border: 0px; float: left;" /></a><!-- 201208010120 mickey@163... -->
170 <div class="sponsbox">
171 <div class="sponsor">
172   <a rel="follow" title="Sponsor: The Fastest &amp; Easiest Way to Find Images" href="http://www.graphicsfactory.com">The Fastest &amp; Easiest Way to Find Images</a><!-- 201210010270 graphicsfac... -->
173 </div>
174 <div class="sponsor">
175   <a rel="follow" title="Sponsor: VPS" href="http://www.interdominios.com/vps">VPS</a><!-- 201209010090 barsh@inter... -->
176 </div>
177 <div class="sponsor">
178   <a rel="follow" title="Werbebanner Werbeplane" href="http://www.allesbanner.de">Werbebanner Werbeplane</a><!-- 201212010450 info@druck... -->
179 </div>
180 <div class="sponsor">
181   <a rel="follow" title="Entertainment News &amp; Photos" href="http://www.zimbio.com">Entertainment News &amp; Photos</a><!-- 201211010540 bd@zimb... -->
182 </div>
183 <div class="sponsor">
184   <a rel="follow" title="Sponsor: LED24" href="http://led24.de/">LED24</a><!-- 201207010270 info@led24... -->
185 </div>
186 <div class="sponsor">
187   <a rel="follow" title="Sponsor: Best Website Hosting" href="http://www.top-cheap-web-hosting.com">Best Website Hosting</a><!-- 201304010090 eunge.liu-->
188 </div>
189 <div class="sponsor">
190   <a rel="follow" title="Android Tablet" href="http://www.dinodirect.com/ipads-tablets/">Android Tablet</a><!-- 201208010120 mickey@163... -->
191 </div>
192 <div class="sponsor">
193   <a rel="follow" title="Sponsor: Web Site Hosting" href="http://webhostinggeeks.com">Web Site Hosting</a><!-- 201302010900 funds@enmob... -->
194 </div>
195 <div class="sponsor">
196    <a rel="follow" title="Sponsor: Premium Quality Stock Photos" href="http://www.f1online.pro/en/">Premium Quality Stock Photos</a><!-- 2012080100540 ... -->
197 </div>
198 <div class="sponsor">
199    <a rel="follow" title="Sponsor: Druckerei" href="http://print24.com/de/">Druckerei</a><!-- 2012070100250 ... -->
200 </div>
201 <div class="sponsor">
202   <a rel="follow" title="Sponsor: Managed Server" href="http://www.robhost.de">Managed Server</a><!-- 201210010720 klikics... -->
203 </div>
204 <div class="sponsor">
205   <a rel="follow" title="Sponsor: Druckerei" href="http://www.allesdruck.de">Druckerei</a><!-- 201303011500 r.leo -->
206 </div>
207 <div  class="sponsor">
208    <a rel="follow" title="Sponsor: Kaffeemaschinen reparatur" href="http://www.kaffeemaschinen-reparatur.de">Kaffeemaschinen reparatur</a><!-- 2012080100030 Temurbas atlas-multimedia-->
209 </div>
210 <div class="sponsor">
211    <a rel="follow" title="Sponsor: Web Hosting" href="http://www.hostucan.com">Web Hosting</a><!-- 2012120100150 racent marketing@webhosting...-->
212 </div>
213 </div>
214 </div>
215 </div>\r
216 \r
217 <div class="eastbar">\r
218   <div class="g-plusone" id="gplusone"></div>\r
219   <script type="text/javascript">\r
220     window.___gcfg = {\r
221       lang: 'en-US'\r
222     };\r
223 \r
224     (function() {\r
225       var po = document.createElement('script');\r
226       po.type = 'text/javascript'; po.async = true;\r
227       po.src = 'https://apis.google.com/js/plusone.js';\r
228       var script = document.getElementsByTagName('script')[0];\r
229       script.parentNode.insertBefore(po, script);\r
230     })();\r
231     var gplusone = document.getElementById("gplusone");\r
232     gplusone.setAttribute("data-size","medium");\r
233     gplusone.setAttribute("data-count","false");\r
234   </script>\r
235 </div>\r
236 \r
237 <div class="main">\r
238 \r
239 \r
240 <h1>PerlMagick API</h1>
241 <p class="navigation-index">[<a href="perl-magick.html#installation">Installation</a> &bull; <a href="perl-magick.html#overview">Overview</a> &bull; <a href="perl-magick.html#example">Example Script</a> &bull; <a href="perl-magick.html#read">Read or Write an Image</a> &bull; <a href="perl-magick.html#manipulate">Manipulate an Image</a> &bull; <a href="perl-magick.html#set-attribute">Set an Image Attribute</a> &bull; <a href="perl-magick.html#get-attribute">Get an Image Attribute</a> &bull; <a href="perl-magick.html#compare">Compare an Image to its Reconstruction</a> &bull; <a href="perl-magick.html#montage">Create an Image Montage</a> &bull; <a href="perl-magick.html#blobs">Working with Blobs</a> &bull; <a href="perl-magick.html#direct-access">Direct-access to Image Pixels</a> &bull; <a href="perl-magick.html#miscellaneous">Miscellaneous Methods</a> &bull; <a href="perl-magick.html#exceptions">Handling Exceptions</a>&bull; <a href="perl-magick.html#constants">Constant</a> ]</p>
242
243 <div class="doc-section">
244 <a id="introduction"></a>
245 <p><a href="download.html">PerlMagick</a> is an objected-oriented <a href="http://www.perl.com/perl/">Perl</a> interface to ImageMagick. Use the module to read, manipulate, or write an image or image sequence from within a Perl script. This makes it very suitable for Web CGI scripts. You must have ImageMagick 6.5.5 or above and Perl version 5.005_02 or greater installed on your system for PerlMagick to build properly.</p>
246
247 <p>There are a number of useful scripts available to show you the value of PerlMagick. You can do Web based image manipulation and conversion with <a href="http://www.imagemagick.org/download/perl">MagickStudio</a>, or use <a href="https://www.imagemagick.org/subversion/ImageMagick/trunk/PerlMagick/demo/">L-systems</a> to create images of plants using mathematical constructs, and finally navigate through collections of thumbnail images and select the image to view with the <a href="http://webmagick.sourceforge.net/">WebMagick Image Navigator</a>.</p>
248
249 <p>You can try PerlMagick from your Web browser at the <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">ImageMagick Studio</a>. Or, you can see <a href="examples.html">examples</a> of select PerlMagick functions.</p>
250 </div>
251
252 <h2><a id="installation"></a>Installation</h2>
253 <div class="doc-section">
254
255 <p><b>UNIX</b></p>
256
257 <p>The following instructions for Unix apply only to the unbundled PerlMagick as obtained from CPAN. PerlMagick is included as a subdirectory (PerlMagick) of the ImageMagick source distribution, and may be configured and built using the instructions provided in the ImageMagick distribution's README.txt file. It is usually most convenient to install PerlMagick as part of the ImageMagick distribution.</p>
258
259 <p>ImageMagick must already be installed on your system. Next, get
260 the <a href="download.html">PerlMagick</a> distribution corresponding to the installed ImageMagick distribution
261 (e.g., PerlMagick 6.77 for
262 ImageMagick 6.7.7) and unpack it as shown below:</p>
263
264 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>tar xvfz PerlMagick-6.77.tar.gz</span><span class='crtout'></span><span class="crtprompt"> $ </span><span class='crtin'>cd PerlMagick</span></p>
265 <p>Next, edit <kbd>Makefile.PL</kbd> and change LIBS and INC to include the appropriate path information to the required <kbd>MagickCore</kbd> library. You may need paths to JPEG, PNG, TIFF, etc.  delegates if they were included with your installed version of ImageMagick. Build and install it like this:</p>
266
267 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>perl Makefile.PL</span><span class='crtout'></span><span class="crtprompt"> $ </span><span class='crtin'>make</span><span class='crtout'></span><span class="crtprompt"> $ </span><span class='crtin'>make install</span></p>
268 <p>For Unix, you typically need to be <kbd>root</kbd> to install the software. There are ways around this. Consult the Perl manual pages for more information.</p>
269
270 <p><b>Windows XP / Windows 2000</b></p>
271
272 <p>ImageMagick must already be installed on your system. Also, the ImageMagick source distribution for <a href="download.html">Windows 2000</a> is required. You must also have the <kbd>nmake</kbd> from the Visual C++ or J++ development environment. Copy <kbd>\bin\IMagick.dll</kbd> and <kbd>\bin\X11.dll</kbd> to a directory in your dynamic load path such as <kbd>c:\perl\site\5.00502</kbd>.</p>
273
274 <p>Next, type</p>
275
276 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>cd PerlMagick</span><span class='crtout'></span><span class="crtprompt"> $ </span><span class='crtin'>perl Makefile.nt</span><span class='crtout'></span><span class="crtprompt"> $ </span><span class='crtin'>nmake</span><span class='crtout'></span><span class="crtprompt"> $ </span><span class='crtin'>nmake install</span></p>
277 <p>See the <a href="http://www.dylanbeattie.net/magick/">PerlMagick Windows HowTo</a> page for further installation instructions.</p>
278
279 <p><b>Running the Regression Tests</b></p>
280
281 <p>To verify a correct installation, type</p>
282
283 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>make test</span></p>
284 <p>Use <kbd>nmake test</kbd> under Windows. There are a few demonstration scripts available to exercise many of the functions PerlMagick can perform. Type</p>
285
286 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>cd demo</span><span class='crtout'></span><span class="crtprompt"> $ </span><span class='crtin'>make</span></p>
287 <p>You are now ready to utilize the PerlMagick methods from within your Perl scripts.</p>
288
289 </div>
290
291 <h2><a id="overview"></a>Overview</h2>
292 <div class="doc-section">
293
294 <p>Any script that wants to use PerlMagick methods must first define the methods within its namespace and instantiate an image object. Do this with:</p>
295
296 <pre class="code">
297   use Image::Magick;
298
299   $image=Image::Magick-&gt;new;
300 </pre>
301
302 <p>The new() method takes the same parameters as <a href="perl-magick.html#set-attribute">SetAttribute</a> . For example,</p>
303
304 <pre class="code">
305   $image=Image::Magick-&gt;new(size=&gt;'384x256');
306 </pre>
307
308 <p>Next you will want to read an image or image sequence, manipulate it, and then display or write it. The input and output methods for PerlMagick are defined in <a href="perl-magick.html#read">Read or Write an Image</a>. See <a href="perl-magick.html#set-attribute">Set an Image Attribute</a> for methods that affect the way an image is read or written. Refer to <a href="perl-magick.html#manipulate">Manipulate an Image</a> for a list of methods to transform an image. <a href="perl-magick.html#get-attribute">Get an Image Attribute</a> describes how to retrieve an attribute for an image. Refer to <a href="perl-magick.html#montage">Create an Image Montage</a> for details about tiling your images as thumbnails on a background. Finally, some methods do not neatly fit into any of the categories just mentioned. Review <a href="perl-magick.html#misc">Miscellaneous Methods</a> for a list of these methods.</p>
309
310 <p>Once you are finished with a PerlMagick object you should consider destroying it. Each image in an image sequence is stored in virtual memory. This can potentially add up to mebibytes of memory. Upon destroying a PerlMagick object, the memory is returned for use by other Perl methods. The recommended way to destroy an object is with <kbd>undef</kbd>:</p>
311
312 <pre class="code">
313   undef $image;
314 </pre>
315
316 <p>To delete all the images but retain the <kbd>Image::Magick</kbd> object use</p>
317
318 <pre class="code">
319   @$image = ();
320 </pre>
321
322 <p>and finally, to delete a single image from a multi-image sequence, use</p>
323
324 <pre class="code">
325   undef $image-&gt;[$x];
326 </pre>
327
328 <p>The next section illustrates how to use various PerlMagick methods to manipulate an image sequence.</p>
329
330 <p>Some of the PerlMagick methods require external programs such as <a href="http://www.cs.wisc.edu/~ghost/">Ghostscript</a>. This may require an explicit path in your PATH environment variable to work properly. For example (in Unix),</p>
331
332 <p class='crt'><span class="crtprompt"> $ </span><span class='crtin'>$ENV{PATH}='/../bin:/usr/bin:/usr/local/bin';</span></p>
333 <div style="margin: auto;">
334 <h2><a id="example"></a>Example Script</h2>
335 </div>
336
337 <p>Here is an example script to get you started:</p>
338
339 <pre class="code">
340   #!/usr/local/bin/perl
341   use Image::Magick;<br />
342   my($image, $x);<br />
343   $image = Image::Magick-&gt;new;
344   $x = $image-&gt;Read('girl.png', 'logo.png', 'rose.png');
345   warn "$x" if "$x";<br />
346   $x = $image-&gt;Crop(geometry=&gt;'100x100+100+100');
347   warn "$x" if "$x";<br />
348   $x = $image-&gt;Write('x.png');
349   warn "$x" if "$x";
350 </pre>
351
352 <p>The script reads three images, crops them, and writes a single image as a GIF animation sequence. In many cases you may want to access individual images of a sequence. The next example illustrates how this done:</p>
353
354 <pre class="code">
355   #!/usr/local/bin/perl
356   use Image::Magick;<br />
357   my($image, $p, $q);<br />
358   $image = new Image::Magick;
359   $image-&gt;Read('x1.png');
360   $image-&gt;Read('j*.jpg');
361   $image-&gt;Read('k.miff[1, 5, 3]');
362   $image-&gt;Contrast();
363   for ($x = 0; $image-&gt;[$x]; $x++)
364   {
365     $image-&gt;[$x]-&gt;Frame('100x200') if $image-&gt;[$x]-&gt;Get('magick') eq 'GIF';
366     undef $image-&gt;[$x] if $image-&gt;[$x]-&gt;Get('columns') &lt; 100;
367   }
368   $p = $image-&gt;[1];
369   $p-&gt;Draw(stroke=&gt;'red', primitive=&gt;'rectangle', points=&gt;20,20 100,100');
370   $q = $p-&gt;Montage();
371   undef $image;
372   $q-&gt;Write('x.miff');
373 </pre>
374
375 <p>Suppose you want to start out with a 100 by 100 pixel white canvas with a red pixel in the center. Try</p>
376
377 <pre class="code">
378   $image = Image::Magick-&gt;new;
379   $image-&gt;Set(size=&gt;'100x100');
380   $image-&gt;ReadImage('canvas:white');
381   $image-&gt;Set('pixel[49,49]'=&gt;'red');
382 </pre>
383
384 <p>Here we reduce the intensity of the red component at (1,1) by half:</p>
385
386 <pre class="code">
387   @pixels = $image-&gt;GetPixel(x=&gt;1,y=&gt;1);
388   $pixels[0]*=0.5;
389   $image-&gt;SetPixel(x=&gt;1,y=&gt;1,color=&gt;\@pixels);
390 </pre>
391
392 <p>Or suppose you want to convert your color image to grayscale:</p>
393
394 <pre class="code">
395   $image-&gt;Quantize(colorspace=&gt;'gray');
396 </pre>
397
398 <p>Let's annotate an image with a Taipai TrueType font:</p>
399
400 <pre class="code">
401   $text = 'Works like magick!';
402   $image-&gt;Annotate(font=&gt;'kai.ttf', pointsize=&gt;40, fill=&gt;'green', text=&gt;$text);
403 </pre>
404
405 <p>Perhaps you want to extract all the pixel intensities from an image and write them to STDOUT:</p>
406
407 <pre class="code">
408   @pixels = $image-&gt;GetPixels(map=&gt;'I', height=&gt;$height, width=&gt;$width, normalize=&gt;true);
409   binmode STDOUT;
410   print pack('B*',join('',@pixels));
411 </pre>
412
413 <p>Other clever things you can do with a PerlMagick objects include</p>
414
415 <pre  class="code">
416   $i = $#$p"+1";   # return the number of images associated with object p
417   push(@$q, @$p);  # push the images from object p onto object q
418   @$p = ();        # delete the images but not the object p
419   $p-&gt;Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]);   # 3x3 Gaussian kernel
420 </pre>
421
422 <div style="margin: auto;">
423   <h2><a id="read"></a>Read or Write an Image</h2>
424 </div>
425
426 <p>Use the methods listed below to either read, write, or display an image or image sequence:</p>
427
428 <table class="doc">
429 <caption>Read or Write Methods</caption>
430 <colgroup>
431   <col width="20%"></col>
432   <col width="20%"></col>
433   <col width="20%"></col>
434   <col width="40%"></col>
435 </colgroup>
436 <tbody>
437
438   <tr>
439     <th>Method</th>
440     <th>Parameters</th>
441     <th>Return Value</th>
442     <th>Description</th>
443   </tr>
444
445   <tr>
446     <td valign="top">Read</td>
447     <td valign="top">one or more filenames</td>
448     <td valign="top">the number of images read</td>
449     <td valign="top">read an image or image sequence</td>
450   </tr>
451
452   <tr>
453     <td valign="top">Write</td>
454     <td valign="top">filename</td>
455     <td valign="top">the number of images written</td>
456     <td valign="top">write an image or image sequence</td>
457   </tr>
458
459   <tr>
460     <td valign="top">Display</td>
461     <td valign="top">server name</td>
462     <td valign="top">the number of images displayed</td>
463     <td valign="top">display the image or image sequence to an X server</td>
464   </tr>
465
466   <tr>
467     <td valign="top">Animate</td>
468     <td valign="top">server name</td>
469     <td valign="top">the number of images animated</td>
470     <td valign="top">animate image sequence to an X server</td>
471   </tr>
472 </tbody>
473 </table>
474
475 <p>For convenience, methods Write(), Display(), and Animate() can take any parameter that <a href="perl-magick.html#set-attribute">SetAttribute</a> knows about. For example,</p>
476
477 <pre class="code">
478   $image-&gt;Write(filename=&gt;'image.png', compression=&gt;'None');
479 </pre>
480
481 <p>Use <kbd>-</kbd> as the filename to method Read() to read from standard in or to method Write() to write to standard out:</p>
482
483 <pre class="code">
484   binmode STDOUT;
485   $image-&gt;Write('png:-');
486 </pre>
487
488 <p>To read an image in the GIF format from a PERL filehandle, use:</p>
489
490 <pre class="code">
491   $image = Image::Magick-&gt;new;
492   open(IMAGE, 'image.gif');
493   $image-&gt;Read(file=&gt;\*IMAGE);
494   close(IMAGE);
495 </pre>
496
497 <p>To write an image in the PNG format to a PERL filehandle, use:</p>
498
499 <pre class="code">
500   $filename = "image.png";
501   open(IMAGE, ">$filename");
502   $image-&gt;Write(file=&gt;\*IMAGE, filename=&gt;$filename);
503   close(IMAGE);
504 </pre>
505
506 <p>Note, reading from or writing to a Perl filehandle may fail under Windows due to different versions of the C-runtime libraries between ImageMagick and the ActiveState Perl distributions or if one of the DLL's is linked with the /MT option.  See <a href="http://msdn.microsoft.com/en-us/library/ms235460.aspx">Potential Errors Passing CRT Objects Across DLL Boundaries</a> for an explanation.</p>
507
508 <p>If <kbd>%0Nd, %0No, or %0Nx</kbd> appears in the filename, it is interpreted as a printf format specification and the specification is replaced with the specified decimal, octal, or hexadecimal encoding of the scene number. For example,</p>
509
510 <pre class="text">
511   image%03d.miff
512 </pre>
513
514 <p>converts files image000.miff, image001.miff, etc.</p>
515
516 <p>You can optionally add <i>Image</i> to any method name. For example, ReadImage() is an alias for method Read().</p>
517
518 </div>
519
520 <h2><a id="manipulate"></a>Manipulate an Image</h2>
521 <div class="doc-section">
522
523 <p>Once you create an image with, for example, method ReadImage() you may want to operate on it. Below is a list of all the image manipulations methods available to you with PerlMagick.  There are <a href="examples.html">examples</a> of select PerlMagick methods. Here is an example call to an image manipulation method:</p>
524
525 <pre class="code">
526   $image-&gt;Crop(geometry=&gt;'100x100+10+20');
527   $image-&gt;[$x]-&gt;Frame("100x200");
528 </pre>
529
530 <p>And here is a list of other image manipulation methods you can call:</p>
531
532 <table class="doc">
533 <caption>Image Manipulation Methods</caption>
534 <tbody>
535   <tr>
536     <th>Method</th>
537     <th style="width: 40%">Parameters</th>
538     <th style="width: 40%">Description</th>
539   </tr>
540
541   <tr>
542     <td valign="top">AdaptiveBlur</td>
543     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
544     <td valign="top">adaptively blur the image with a Gaussian operator of the given radius and standard deviation (sigma).  Decrease the effect near edges.</td>
545   </tr>
546
547   <tr>
548     <td valign="top">AdaptiveResize</td>
549     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, filter=&gt;{Point, Box, Triangle, Hermite, Hanning, Hamming, Blackman, Gaussian, Quadratic, Cubic, Catrom, Mitchell, Lanczos, Bessel, Sinc}, support=&gt;<i>double</i>, blur=&gt;<i>double</i></td>
550     <td valign="top">adaptively resize image using data dependant triangulation. Specify <kbd>blur</kbd> &gt; 1 for blurry or &lt; 1 for sharp</td>
551   </tr>
552
553   <tr>
554     <td valign="top">AdaptiveSharpen</td>
555     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
556     <td valign="top">adaptively sharpen the image with a Gaussian operator of the given radius and standard deviation (sigma).  Increase the effect near edges.</td>
557   </tr>
558
559   <tr>
560     <td valign="top">AdaptiveThreshold</td>
561     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, offset=&gt;<i>integer</i></td>
562     <td valign="top">local adaptive thresholding.</td>
563   </tr>
564
565   <tr>
566     <td valign="top">AddNoise</td>
567     <td valign="top">noise=&gt;{Uniform, Gaussian, Multiplicative, Impulse, Laplacian, Poisson}, attenuate=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
568     <td valign="top">add noise to an image</td>
569   </tr>
570
571   <tr>
572     <td valign="top">AffineTransform</td>
573     <td valign="top">affine=&gt;<i>array of float values</i>, translate=&gt;<i>float, float</i>, scale=&gt; <i>float, float</i>, rotate=&gt;<i>float</i>, skewX=&gt;<i>float</i>, skewY=&gt;<i>float</i>, interpolate={Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor}, background=&gt;<i><a href="color.html">color name</a></i></td>
574     <td valign="top">affine transform image</td>
575   </tr>
576
577   <tr>
578     <td valign="top">Affinity</td>
579     <td valign="top">image=&gt;<i>image-handle</i>, method=&gt;{None, FloydSteinberg, Riemersma}</td>
580     <td valign="top">choose a particular set of colors from this image</td>
581   </tr>
582
583   <tr>
584     <td valign="top">Annotate</td>
585     <td valign="top">text=&gt;<i>string</i>, font=&gt;<i>string</i>, family=&gt;<i>string</i>, style=&gt;{Normal, Italic, Oblique, Any}, stretch=&gt;{Normal, UltraCondensed, ExtraCondensed, Condensed, SemiCondensed, SemiExpanded, Expanded, ExtraExpanded, UltraExpanded}, weight=&gt;<i>integer</i>, pointsize=&gt;<i>integer</i>, density=&gt;<i>geometry</i>, stroke=&gt;<i><a href="color.html">color name</a></i>, strokewidth=&gt;<i>integer</i>, fill=&gt;<i><a href="color.html">color name</a></i>, undercolor=&gt;<i><a href="color.html">color name</a></i>, kerning=&gt;<i>float</i>, geometry=&gt;<i>geometry</i>, gravity=&gt;{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}, antialias=&gt;{true, false}, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, affine=&gt;<i>array of float values</i>, translate=&gt;<i>float, float</i>, scale=&gt;<i>float, float</i>, rotate=&gt;<i>float</i>. skewX=&gt;<i>float</i>, skewY=&gt; <i>float</i>, align=&gt;{Left, Center, Right}, encoding=&gt;{UTF-8}, interline-spacing=&gt;<i>double</i>, interword-spacing=&gt;<i>double</i>, direction=&gt;{right-to-left, left-to-right}</td>
586     <td valign="top">annotate an image with text. See <a href="perl-magick.html#misc">QueryFontMetrics</a> to get font metrics without rendering any text.</td>
587   </tr>
588
589   <tr>
590     <td valign="top">AutoGamma</td>
591     <td valign="top">channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
592     <td valign="top">automagically adjust gamma level of image</td>
593   </tr>
594
595   <tr>
596     <td valign="top">AutoLevel</td>
597     <td valign="top">channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
598     <td valign="top">automagically adjust color levels of image</td>
599   </tr>
600
601   <tr>
602     <td valign="top">AutoOrient</td>
603     <td valign="top"><br /></td>
604     <td valign="top">automagically orient the image</td>
605   </tr>
606
607   <tr>
608     <td valign="top">BlackThreshold</td>
609     <td valign="top">threshold=&gt;<i>string</i>, , channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
610     <td valign="top">force all pixels below the threshold intensity into black</td>
611   </tr>
612
613   <tr>
614     <td valign="top">BlueShift</td>
615     <td valign="top">factor=&gt;<i>double</i>,</td>
616     <td valign="top">simulate a scene at nighttime in the moonlight.  Start with a factor of 1.5.</td>
617   </tr>
618
619   <tr>
620     <td valign="top">Blur</td>
621     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
622     <td valign="top">reduce image noise and reduce detail levels with a Gaussian operator of the given radius and standard deviation (sigma).</td>
623   </tr>
624
625   <tr>
626     <td valign="top">Border</td>
627     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, bordercolor=&gt;<i><a href="color.html">color name</a></i>,  compose=&gt;{Undefined, Add, Atop, Blend, Bumpmap, Clear, ColorBurn, ColorDodge, Colorize, CopyBlack, CopyBlue, CopyCMYK, Cyan, CopyGreen, Copy, CopyMagenta, CopyOpacity, CopyRed, RGB, CopyYellow, Darken, Dst, Difference, Displace, Dissolve, DstAtop, DstIn, DstOut, DstOver, Dst, Exclusion, HardLight, Hue, In, Lighten, Luminize, Minus, Modulate, Multiply, None, Out, Overlay, Over, Plus, ReplaceCompositeOp, Saturate, Screen, SoftLight, Src, SrcAtop, SrcIn, SrcOut, SrcOver, Src, Subtract, Threshold, Xor },</td>
628     <td valign="top">surround the image with a border of color</td>
629   </tr>
630
631   <tr>
632     <td valign="top">Charcoal</td>
633     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i></td>
634     <td valign="top">simulate a charcoal drawing</td>
635   </tr>
636
637   <tr>
638     <td valign="top">Chop</td>
639     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i></td>
640     <td valign="top">chop an image</td>
641   </tr>
642
643   <tr>
644     <td valign="top">Clamp</td>
645     <td valign="top"><br /></td>
646     <td valign="top">restrict color values from 0 to the quantum depth.</td>
647   </tr>
648
649   <tr>
650     <td valign="top">Clip</td>
651     <td valign="top">id=&gt;<i>name</i>, inside=&gt;<i>{true, false}</i>,</td>
652     <td valign="top">apply along a named path from the 8BIM profile.</td>
653   </tr>
654
655   <tr>
656     <td valign="top">ClipMask</td>
657     <td valign="top">mask=&gt;<i>image-handle</i></td>
658     <td valign="top">clip image as defined by the image mask</td>
659   </tr>
660
661   <tr>
662     <td valign="top">Clut</td>
663     <td valign="top">image=&gt;<i>image-handle</i>,  interpolate={Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor}, channel=&gt;{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td>
664     <td valign="top">apply a color lookup table to an image sequence</td>
665   </tr>
666
667   <tr>
668     <td valign="top">Coalesce</td>
669     <td valign="top"><br /></td>
670     <td valign="top">merge a sequence of images</td>
671   </tr>
672
673   <tr>
674     <td valign="top">Color</td>
675     <td valign="top">color=&gt;<i><a href="color.html">color name</a></i></td>
676     <td valign="top">set the entire image to this color.</td>
677   </tr>
678
679   <tr>
680     <td valign="top">ColorDecisionList</td>
681     <td valign="top">filename=&gt;<i>string</i>,</td>
682     <td valign="top">color correct with a color decision list.</td>
683   </tr>
684
685   <tr>
686     <td valign="top">Colorize</td>
687     <td valign="top">fill=&gt;<i><a href="color.html">color name</a></i>, blend=&gt;<i>string</i></td>
688     <td valign="top">colorize the image with the fill color</td>
689   </tr>
690
691   <tr>
692     <td valign="top">ColorMatrix</td>
693     <td valign="top">matrix=&gt;<i>array of float values</i></td>
694     <td valign="top">apply color correction to the image.  Although you can use variable sized matrices, typically you use a 5 x 5 for an RGBA image and a 6x6 for CMYKA.  A 6x6 matrix is required for offsets (populate the last column with normalized values).</td>
695   </tr>
696
697   <tr>
698     <td valign="top">Comment</td>
699     <td valign="top">string</td>
700     <td valign="top">add a comment to your image</td>
701   </tr>
702
703   <tr>
704     <td valign="top">CompareLayers</td>
705     <td valign="top">method=&gt;{any, clear, overlay}</td>
706     <td valign="top">compares each image with the next in a sequence and returns the minimum bounding region of any pixel differences it discovers.  Images do not have to be the same size, though it is best that all the images are coalesced (images are all the same size, on a flattened canvas, so as to represent exactly how a specific frame should look).</td>
707   </tr>
708
709   <tr>
710     <td valign="top">Composite</td>
711     <td valign="top">image=&gt;<i>image-handle</i>, compose=&gt;{Undefined, Add, Atop, Blend, Bumpmap, Clear, ColorBurn, ColorDodge, Colorize, CopyBlack, CopyBlue, CopyCMYK, Cyan, CopyGreen, Copy, CopyMagenta, CopyOpacity, CopyRed, RGB, CopyYellow, Darken, Dst, Difference, Displace, Dissolve, DstAtop, DstIn, DstOut, DstOver, Dst, Exclusion, HardLight, Hue, In, Lighten, Luminize, Minus, Modulate, Multiply, None, Out, Overlay, Over, Plus, ReplaceCompositeOp, Saturate, Screen, SoftLight, Src, SrcAtop, SrcIn, SrcOut, SrcOver, Src, Subtract, Threshold, Xor }, mask=&gt;<i>image-handle</i>, geometry=&gt;<i>geometry</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, gravity=&gt;{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}, opacity=&gt;<i>integer</i>, tile=&gt;{True, False}, rotate=&gt;<i>double</i>, color=&gt;<i><a href="color.html">color name</a></i>, blend=&gt;<i>geometry</i>, interpolate=&gt;{undefined, average, bicubic, bilinear, filter, integer, mesh, nearest-neighbor, spline}</td>
712     <td valign="top">composite one image onto another.  Use the rotate parameter in concert with the tile parameter.</td>
713   </tr>
714
715   <tr>
716     <td valign="top">Contrast</td>
717     <td valign="top">sharpen=&gt;{True, False}</td>
718     <td valign="top">enhance or reduce the image contrast</td>
719   </tr>
720
721   <tr>
722     <td valign="top">ContrastStretch</td>
723     <td valign="top">levels=&gt;<i>string</i>, 'black-point'=&gt;<i>double</i>, 'white-point'=&gt;<i>double</i>, channel=&gt;{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td>
724     <td valign="top">improve the contrast in an image by `stretching' the range of intensity values</td>
725   </tr>
726
727   <tr>
728     <td valign="top">Convolve</td>
729     <td valign="top">coefficients=&gt;<i>array of float values</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, bias=&gt;<i>double</i></td>
730     <td valign="top">apply a convolution kernel to the image. Given a kernel <i>order</i> , you would supply <i>order*order</i> float values (e.g. 3x3 implies 9 values).</td>
731   </tr>
732
733   <tr>
734     <td valign="top">Crop</td>
735     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, fuzz=&gt;<i>double</i>, gravity=&gt;{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td>
736     <td valign="top">crop an image</td>
737   </tr>
738
739   <tr>
740     <td valign="top">CycleColormap</td>
741     <td valign="top">amount=&gt;<i>integer</i></td>
742     <td valign="top">displace image colormap by amount</td>
743   </tr>
744
745   <tr>
746     <td valign="top">Decipher</td>
747     <td valign="top">passphrase=&gt;<i>string</i></td>
748     <td valign="top">convert cipher pixels to plain pixels</td>
749   </tr>
750
751   <tr>
752     <td valign="top">Deconstruct</td>
753     <td valign="top"><br /></td>
754     <td valign="top">break down an image sequence into constituent parts</td>
755   </tr>
756
757   <tr>
758     <td valign="top">Deskew</td>
759     <td valign="top">geometry=&gt;<i>string</i>,threshold=&gt;<i>double</i></td>
760     <td valign="top">straighten the image</td>
761   </tr>
762
763   <tr>
764     <td valign="top">Despeckle</td>
765     <td valign="top">&nbsp;</td>
766     <td valign="top">reduce the speckles within an image</td>
767   </tr>
768
769   <tr>
770     <td valign="top">Difference</td>
771     <td valign="top">image=&gt;<i>image-handle</i></td>
772     <td valign="top">compute the difference metrics between two images </td>
773   </tr>
774
775   <tr>
776     <td valign="top">Distort</td>
777     <td valign="top">points=&gt;<i>array of float values</i>, method=&gt;{Affine, AffineProjection, Bilinear, Perspective, Resize, ScaleRotateTranslate}, virtual-pixel=&gt;{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}, best-fit=&gt;{True, False}</td>
778     <td valign="top">distort image</td>
779   </tr>
780
781   <tr>
782     <td valign="top">Draw</td>
783     <td valign="top">primitive=&gt;{point, line, rectangle, arc, ellipse, circle, path, polyline, polygon, bezier, color, matte, text, @<i>filename</i>}, points=&gt;<i>string</i> , method=&gt;<i>{Point, Replace, Floodfill, FillToBorder, Reset}</i>, stroke=&gt;<i><a href="color.html">color name</a></i>, fill=&gt;<i><a href="color.html">color name</a></i>, font=&gt;<i>string</i>, pointsize=&gt;<i>integer</i>, strokewidth=&gt;<i>float</i>, antialias=&gt;{true, false}, bordercolor=&gt;<i><a href="color.html">color name</a></i>, x=&gt;<i>float</i>, y=&gt;<i>float</i>, dash-offset=&gt;<i>float</i>, dash-pattern=&gt;<i>array of float values</i>, affine=&gt;<i>array of float values</i>, translate=&gt;<i>float, float</i>, scale=&gt;<i>float, float</i>, rotate=&gt;<i>float</i>,  skewX=&gt;<i>float</i>, skewY=&gt;<i>float</i>, interpolate=&gt;{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}, kerning=&gt;<i>float</i>, text=&gt;<i>string</i>, vector-graphics=&gt;<i>string</i>, interline-spacing=&gt;<i>double</i>, interword-spacing=&gt;<i>double</i>, direction=&gt;{right-to-left, left-to-right}</td>
784     <td valign="top">annotate an image with one or more graphic primitives.</td>
785   </tr>
786
787   <tr>
788     <td valign="top">Encipher</td>
789     <td valign="top">passphrase=&gt;<i>string</i></td>
790     <td valign="top">convert plain pixels to cipher pixels</td>
791   </tr>
792
793   <tr>
794     <td valign="top">Edge</td>
795     <td valign="top">radius=&gt;<i>double</i></td>
796     <td valign="top">enhance edges within the image with a convolution filter of the given radius.</td>
797   </tr>
798
799   <tr>
800     <td valign="top">Emboss</td>
801     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i></td>
802     <td valign="top">emboss the image with a convolution filter of the given radius and standard deviation (sigma).</td>
803   </tr>
804
805   <tr>
806     <td valign="top">Enhance</td>
807     <td valign="top"><br /></td>
808     <td valign="top">apply a digital filter to enhance a noisy image</td>
809   </tr>
810
811   <tr>
812     <td valign="top">Equalize</td>
813     <td valign="top">channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}<br /></td>
814     <td valign="top">perform histogram equalization to the image</td>
815   </tr>
816
817   <tr>
818     <td valign="top">Extent</td>
819     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, fuzz=&gt;<i>double</i>, background=&gt;<i><a href="color.html">color name</a></i>, gravity=&gt;{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td>
820     <td valign="top">set the image size</td>
821   </tr>
822
823   <tr>
824     <td valign="top">Evaluate</td>
825     <td valign="top">value=&gt;<i>double</i>, operator=&gt;<i>{Add, And, Divide, LeftShift, Max, Min, Multiply, Or, Rightshift, Subtract, Xor}</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow} </td>
826     <td valign="top">apply an arithmetic, relational, or logical expression to the image</td>
827   </tr>
828
829   <tr>
830     <td valign="top">Filter</td>
831     <td valign="top">kernel=&gt;<i>string</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, bias=&gt;<i>double</i></td>
832     <td valign="top">apply a convolution kernel to the image.</td>
833   </tr>
834
835   <tr>
836     <td valign="top">Flip</td>
837     <td valign="top"><br /></td>
838     <td valign="top">reflect the image scanlines in the vertical direction</td>
839   </tr>
840
841   <tr>
842     <td valign="top">Flop</td>
843     <td valign="top"><br /></td>
844     <td valign="top">reflect the image scanlines in the horizontal direction</td>
845   </tr>
846
847   <tr>
848     <td valign="top">FloodfillPaint</td>
849     <td valign="top">geometry=&gt;<i>geometry</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, x=&gt;<i>integer</i>, y=&gt;<i>integer</i> , fill=&gt;<i><a href="color.html">color name</a></i>, bordercolor=&gt;<i><a href="color.html">color name</a></i>, fuzz=&gt;<i>double</i>, invert=&gt;{True, False}</td>
850     <td valign="top">changes the color value of any pixel that matches the color of the target pixel and is a neighbor. If you specify a border color, the color value is changed for any neighbor pixel that is not that color.</td>
851   </tr>
852
853   <tr>
854     <td valign="top">ForwardFourierTransform</td>
855     <td valign="top">magnitude=&gt;{True, False}</td>
856     <td valign="top">implements the forward discrete Fourier transform (DFT)</td>
857   </tr>
858
859   <tr>
860     <td valign="top">Frame</td>
861     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, inner=&gt;<i>integer</i>, outer=&gt;<i>integer</i>, fill=&gt;<i><a href="color.html">color name</a></i>,  compose=&gt;{Undefined, Add, Atop, Blend, Bumpmap, Clear, ColorBurn, ColorDodge, Colorize, CopyBlack, CopyBlue, CopyCMYK, Cyan, CopyGreen, Copy, CopyMagenta, CopyOpacity, CopyRed, RGB, CopyYellow, Darken, Dst, Difference, Displace, Dissolve, DstAtop, DstIn, DstOut, DstOver, Dst, Exclusion, HardLight, Hue, In, Lighten, Luminize, Minus, Modulate, Multiply, None, Out, Overlay, Over, Plus, ReplaceCompositeOp, Saturate, Screen, SoftLight, Src, SrcAtop, SrcIn, SrcOut, SrcOver, Src, Subtract, Threshold, Xor },</td>
862     <td valign="top">surround the image with an ornamental border</td>
863   </tr>
864
865   <tr>
866     <td valign="top">Function</td>
867     <td valign="top">parameters=&gt;<i>array of float values</i>, function=&gt;{Sin}, virtual-pixel=&gt;{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}</td>
868     <td valign="top">apply a function to the image</td>
869   </tr>
870
871   <tr>
872     <td valign="top">Gamma</td>
873     <td valign="top">gamma=&gt;<i>string</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
874     <td valign="top">gamma correct the image</td>
875   </tr>
876
877   <tr>
878     <td valign="top">GaussianBlur</td>
879     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
880     <td valign="top">reduce image noise and reduce detail levels with a Gaussian operator of the given radius and standard deviation (sigma).</td>
881   </tr>
882
883   <tr>
884     <td valign="top">GetPixel</td>
885     <td valign="top">geometry=&gt;<i>geometry</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, normalize=&gt;{true, false}, x=&gt;<i>integer</i>, y=&gt;<i>integer</i></td>
886     <td valign="top">get a single pixel. By default normalized pixel values are returned.</td>
887   </tr>
888
889   <tr>
890     <td valign="top">GetPixels</td>
891     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, map=&gt;<i>string</i>, normalize=&gt;{true, false}</td>
892     <td valign="top">get image pixels as defined by the map (e.g. "RGB", "RGBA", etc.).  By default non-normalized pixel values are returned.</td>
893   </tr>
894
895   <tr>
896     <td valign="top">HaldClut</td>
897     <td valign="top">image=&gt;<i>image-handle</i>,  channel=&gt;{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td>
898     <td valign="top">apply a Hald color lookup table to an image sequence</td>
899   </tr>
900
901   <tr>
902     <td valign="top">Identify</td>
903     <td valign="top">file=&gt;<i>file</i>, features=&gt;<i>distance</i>, unique=&gt;{True, False}</td>
904     <td valign="top">identify the attributes of an image</td>
905   </tr>
906
907   <tr>
908     <td valign="top">Implode</td>
909     <td valign="top">amount=&gt;<i>double</i>, interpolate=&gt;{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}</td>
910     <td valign="top">implode image pixels about the center</td>
911   </tr>
912
913   <tr>
914     <td valign="top">InverseDiscreteFourierTransform</td>
915     <td valign="top">magnitude=&gt;{True, False}</td>
916     <td valign="top">implements the inverse discrete Fourier transform (DFT)</td>
917   </tr>
918
919   <tr>
920     <td valign="top">Label</td>
921     <td valign="top">string</td>
922     <td valign="top">assign a label to an image</td>
923   </tr>
924
925   <tr>
926     <td valign="top">Layers</td>
927     <td valign="top">method=&gt;{coalesce, compare-any, compare-clear, compare-over, composite, dispose, flatten, merge, mosaic, optimize, optimize-image, optimize-plus, optimize-trans, remove-dups, remove-zero},  compose=&gt;{Undefined, Add, Atop, Blend, Bumpmap, Clear, ColorBurn, ColorDodge, Colorize, CopyBlack, CopyBlue, CopyCMYK, Cyan, CopyGreen, Copy, CopyMagenta, CopyOpacity, CopyRed, RGB, CopyYellow, Darken, Dst, Difference, Displace, Dissolve, DstAtop, DstIn, DstOut, DstOver, Dst, Exclusion, HardLight, Hue, In, Lighten, LinearLight, Luminize, Minus, Modulate, Multiply, None, Out, Overlay, Over, Plus, ReplaceCompositeOp, Saturate, Screen, SoftLight, Src, SrcAtop, SrcIn, SrcOut, SrcOver, Src, Subtract, Threshold, Xor }, dither=&gt;{true, false}</td>
928     <td valign="top">compare each image the GIF disposed forms of the previous image in the sequence.  From this, attempt to select the smallest cropped image to replace each frame, while preserving the results of the animation.</td>
929   </tr>
930
931   <tr>
932     <td valign="top">Level</td>
933     <td valign="top">levels=&gt;<i>string</i>, 'black-point'=&gt;<i>double</i>, 'gamma'=&gt;<i>double</i>, 'white-point'=&gt;<i>double</i>, channel=&gt;{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td>
934     <td valign="top">adjust the level of image contrast</td>
935   </tr>
936
937   <tr>
938     <td valign="top">LevelColors</td>
939     <td valign="top">invert=&gt;&gt;{True, False}, 'black-point'=&gt;<i>string</i>,  'white-point'=&gt;<i>string</i>, channel=&gt;{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td>
940     <td valign="top">level image with the given colors</td>
941   </tr>
942
943   <tr>
944     <td valign="top">LinearStretch</td>
945     <td valign="top">levels=&gt;<i>string</i>, 'black-point'=&gt;<i>double</i>, 'white-point'=&gt;<i>double</i></td>
946     <td valign="top">linear with saturation stretch</td>
947   </tr>
948
949   <tr>
950     <td valign="top">LiquidResize</td>
951     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, delta-x=&gt;<i>double</i>, rigidity=&gt;<i>double</i></td>
952     <td valign="top">rescale image with seam-carving.</td>
953   </tr>
954
955   <tr>
956     <td valign="top">Magnify</td>
957     <td valign="top"><br /></td>
958     <td valign="top">double the size of an image</td>
959   </tr>
960
961   <tr>
962     <td valign="top">Mask</td>
963     <td valign="top">mask=&gt;<i>image-handle</i></td>
964     <td valign="top">composite image pixels as defined by the mask</td>
965   </tr>
966
967   <tr>
968     <td valign="top">MatteFloodfill</td>
969     <td valign="top">geometry=&gt;<i>geometry</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i> , matte=&gt;<i>integer</i>, bordercolor=&gt;<i><a href="color.html">color name</a></i>, fuzz=&gt;<i>double</i>, invert=&gt;{True, False}</td>
970     <td valign="top">changes the matte value of any pixel that matches the color of the target pixel and is a neighbor. If you specify a border color, the matte value is changed for any neighbor pixel that is not that color.</td>
971   </tr>
972
973   <tr>
974     <td valign="top">MedianFilter</td>
975     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
976     <td valign="top">replace each pixel with the median intensity pixel of a neighborhood.</td>
977   </tr>
978
979   <tr>
980     <td valign="top">Minify</td>
981     <td valign="top"><br /></td>
982     <td valign="top">half the size of an image</td>
983   </tr>
984
985   <tr>
986     <td valign="top">Mode</td>
987     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
988     <td valign="top">make each pixel the <em>predominant color</em> of the neighborhood.</td>
989   </tr>
990
991   <tr>
992     <td valign="top">Modulate</td>
993     <td valign="top">factor=&gt;<i>geometry</i>, brightness=&gt;<i>double</i>, saturation=&gt;<i>double</i>, hue=&gt;<i>double</i>, lightness=&gt;<i>double</i>, whiteness=&gt;<i>double</i>, blackness=&gt;<i>double</i> </td>
994     <td valign="top">vary the brightness, saturation, and hue of an image by the specified percentage</td>
995   </tr>
996
997   <tr>
998     <td valign="top">Morphology</td>
999     <td valign="top">kernel=&gt;<i>string</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, iterations=&gt;<i>integer</i></td>
1000     <td valign="top">apply a morphology method to the image.</td>
1001   </tr>
1002
1003   <tr>
1004     <td valign="top">MotionBlur</td>
1005     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, angle=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1006     <td valign="top">reduce image noise and reduce detail levels with a Gaussian operator of the given radius and standard deviation (sigma) at the given angle to simulate the effect of motion</td>
1007   </tr>
1008
1009   <tr>
1010     <td valign="top">Negate</td>
1011     <td valign="top">gray=&gt;{True, False}, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1012     <td valign="top">replace each pixel with its complementary color (white becomes black, yellow becomes blue, etc.)</td>
1013   </tr>
1014
1015   <tr>
1016     <td valign="top">Normalize</td>
1017     <td valign="top">channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}<br /></td>
1018     <td valign="top">transform image to span the full range of color values</td>
1019   </tr>
1020
1021   <tr>
1022     <td valign="top">OilPaint</td>
1023     <td valign="top">radius=&gt;<i>integer</i></td>
1024     <td valign="top">simulate an oil painting</td>
1025   </tr>
1026
1027   <tr>
1028     <td valign="top">Opaque</td>
1029     <td valign="top">color=&gt;<i><a href="color.html">color name</a></i>,
1030 fill=&gt;<i><a href="color.html">color name</a></i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, invert=&gt;{True, False}</td>
1031     <td valign="top">change this color to the fill color within the image</td>
1032   </tr>
1033
1034   <tr>
1035     <td valign="top">OrderedDither</td>
1036     <td valign="top">threshold=&gt;{threshold, checks, o2x2, o3x3, o4x4, o8x8, h4x4a, h6x6a, h8x8a, h4x4o, h6x6o, h8x8o, h16x16o, hlines6x4}, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1037     <td valign="top">order dither image</td>
1038   </tr>
1039
1040   <tr>
1041     <td valign="top">Polaroid</td>
1042     <td valign="top">caption=&gt;<i>string</i>, angle=&gt;<i>double</i>, pointsize=&gt;<i>double</i>, font=&gt;<i>string</i>, stroke=&gt; <i><a href="color.html">color name</a></i>, strokewidth=&gt;<i>integer</i>, fill=&gt;<i><a href="color.html">color name</a></i>, gravity=&gt;{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast},  background=&gt;<i><a href="color.html">color name</a></i></td>
1043     <td valign="top">simulate a Polaroid picture.</td>
1044   </tr>
1045
1046   <tr>
1047     <td valign="top">Posterize</td>
1048     <td valign="top">levels=&gt;<i>integer</i>, dither=&gt;{True, False}</td>
1049     <td valign="top">reduce the image to a limited number of color level</td>
1050   </tr>
1051
1052   <tr>
1053     <td valign="top">Profile</td>
1054     <td valign="top">name=&gt;<i>string</i>, profile=&gt;<i>blob</i>, rendering-intent=&gt;{Undefined, Saturation, Perceptual, Absolute, Relative}, black-point-compensation=&gt;{True, False}</td>
1055     <td valign="top">add or remove ICC or IPTC image profile; name is formal name (e.g. ICC or filename; set profile to <kbd>''</kbd> to remove profile</td>
1056   </tr>
1057
1058   <tr>
1059     <td valign="top">Quantize</td>
1060     <td valign="top">colors=&gt;<i>integer</i>, colorspace=&gt;{RGB, Gray, Transparent, OHTA, XYZ, YCbCr, YIQ, YPbPr, YUV, CMYK, sRGB, HSL, HSB}, treedepth=&gt; <i>integer</i>, dither=&gt;{True, False}, dither-method=&gt;{Riemersma, Floyd-Steinberg}, measure_error=&gt;{True, False}, global_colormap=&gt;{True, False}, transparent-color=&gt;<i>color</i></td>
1061     <td valign="top">preferred number of colors in the image</td>
1062   </tr>
1063
1064   <tr>
1065     <td valign="top">RadialBlur</td>
1066     <td valign="top">geometry=&gt;<i>geometry</i>, angle=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1067     <td valign="top">radial blur the image.</td>
1068   </tr>
1069
1070   <tr>
1071     <td valign="top">Raise</td>
1072     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, raise=&gt;{True, False}</td>
1073     <td valign="top">lighten or darken image edges to create a 3-D effect</td>
1074   </tr>
1075
1076   <tr>
1077     <td valign="top">ReduceNoise</td>
1078     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1079     <td valign="top">reduce noise in the image with a noise peak elimination filter</td>
1080   </tr>
1081
1082   <tr>
1083     <td valign="top">Remap</td>
1084     <td valign="top">image=&gt;<i>image-handle</i>,  dither=&gt;{true, false}, dither-method=&gt;{Riemersma, Floyd-Steinberg}</td>
1085     <td valign="top">replace the colors of an image with the closest color from a reference image.</td>
1086   </tr>
1087
1088   <tr>
1089     <td valign="top">Resample</td>
1090     <td valign="top">density=&gt;<i>geometry</i>, x=&gt;<i>double</i>, y=&gt;<i>double</i>, filter=&gt;{Point, Box, Triangle, Hermite, Hanning, Hamming, Blackman, Gaussian, Quadratic, Cubic, Catrom, Mitchell, Lanczos, Bessel, Sinc}, support=&gt;<i>double</i></td>
1091     <td valign="top">resample image to desired resolution. Specify <kbd>blur</kbd> &gt; 1 for blurry or &lt; 1 for sharp</td>
1092   </tr>
1093
1094   <tr>
1095     <td valign="top">Resize</td>
1096     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, filter=&gt;{Point, Box, Triangle, Hermite, Hanning, Hamming, Blackman, Gaussian, Quadratic, Cubic, Catrom, Mitchell, Lanczos, Bessel, Sinc}, support=&gt;<i>double</i>, blur=&gt;<i>double</i></td>
1097     <td valign="top">scale image to desired size. Specify <kbd>blur</kbd> &gt; 1 for blurry or &lt; 1 for sharp</td>
1098   </tr>
1099
1100   <tr>
1101     <td valign="top">Roll</td>
1102     <td valign="top">geometry=&gt;<i>geometry</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i></td>
1103     <td valign="top">roll an image vertically or horizontally</td>
1104   </tr>
1105
1106   <tr>
1107     <td valign="top">Rotate</td>
1108     <td valign="top">degrees=&gt;<i>double</i>, background=&gt;<i><a href="color.html">color name</a></i></td>
1109     <td valign="top">rotate an image</td>
1110   </tr>
1111
1112   <tr>
1113     <td valign="top">Sample</td>
1114     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i></td>
1115     <td valign="top">scale image with pixel sampling.</td>
1116   </tr>
1117
1118   <tr>
1119     <td valign="top">Scale</td>
1120     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i></td>
1121     <td valign="top">scale image to desired size</td>
1122   </tr>
1123
1124   <tr>
1125     <td valign="top">Segment</td>
1126     <td valign="top">colorspace=&gt;{RGB, Gray, Transparent, OHTA, XYZ, YCbCr, YCC, YIQ, YPbPr, YUV, CMYK}, verbose={True, False}, cluster-threshold=&gt;<i>double</i>, smoothing-threshold=<i>double</i></td>
1127     <td valign="top">segment an image by analyzing the histograms of the color components and identifying units that are homogeneous</td>
1128   </tr>
1129
1130   <tr>
1131     <td valign="top">SelectiveBlur</td>
1132     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, threshold=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1133     <td valign="top">selectively blur pixels within a contrast threshold.</td>
1134   </tr>
1135   <tr>
1136     <td valign="top">Separate</td>
1137     <td valign="top">channel=&gt;{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td>
1138     <td valign="top">separate a channel from the image into a grayscale image</td>
1139   </tr>
1140
1141   <tr>
1142     <td valign="top">Shade</td>
1143     <td valign="top">geometry=&gt;<i>geometry</i>, azimuth=&gt;<i>double</i>, elevation=&gt;<i>double</i>, gray=&gt;{true, false}</td>
1144     <td valign="top">shade the image using a distant light source</td>
1145   </tr>
1146
1147   <tr>
1148     <td valign="top">SetPixel</td>
1149     <td valign="top">geometry=&gt;<i>geometry</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, color=&gt;<i>array of float values</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, color=&gt;<i>array of float values</i></td>
1150     <td valign="top">set a single pixel.  By default normalized pixel values are expected.</td>
1151   </tr>
1152
1153   <tr>
1154     <td valign="top">Shadow</td>
1155     <td valign="top">geometry=&gt;<i>geometry</i>, opacity=&gt;<i>double</i>, sigma=&gt;<i>double</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i></td>
1156     <td valign="top">simulate an image shadow</td>
1157   </tr>
1158
1159   <tr>
1160     <td valign="top">Sharpen</td>
1161     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, bias=&gt;<i>double</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1162     <td valign="top">sharpen the image with a Gaussian operator of the given radius and standard deviation (sigma).</td>
1163   </tr>
1164
1165   <tr>
1166     <td valign="top">Shave</td>
1167     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i></td>
1168     <td valign="top">shave pixels from the image edges</td>
1169   </tr>
1170
1171   <tr>
1172     <td valign="top">Shear</td>
1173     <td valign="top">geometry=&gt;<i>geometry</i>, x=&gt;<i>double</i>, y=&gt;<i>double</i> fill=&gt;<i><a href="color.html">color name</a></i></td>
1174     <td valign="top">shear the image along the X or Y axis by a positive or negative shear angle</td>
1175   </tr>
1176
1177   <tr>
1178     <td valign="top">SigmoidalContrast</td>
1179     <td valign="top">geometry=&gt;<i>string</i>, 'contrast'=&gt;<i>double</i>, 'mid-point'=&gt;<i>double</i> channel=&gt;{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}, sharpen=&gt;{True, False}</td>
1180     <td valign="top">sigmoidal non-lineraity contrast control.  Increase the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows. <em class="option">Contrast</em> indicates how much to increase the contrast (0 is none; 3 is typical; 20 is a lot);  <em class="option">mid-point</em> indicates where midtones fall in the resultant image (0 is white; 50% is middle-gray; 100% is black). To decrease contrast, set sharpen to False.</td>
1181   </tr>
1182
1183   <tr>
1184     <td valign="top">Signature</td>
1185     <td valign="top"><br /></td>
1186     <td valign="top">generate an SHA-256 message digest for the image pixel stream</td>
1187   </tr>
1188
1189   <tr>
1190     <td valign="top">Sketch</td>
1191     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, angle=&gt;<i>double</i></td>
1192     <td valign="top">sketch the image with a Gaussian operator of the given radius and standard deviation (sigma) at the given angle</td>
1193   </tr>
1194
1195   <tr>
1196     <td valign="top">Solarize</td>
1197     <td valign="top">geometry=&gt;<i>string</i>,threshold=&gt;<i>double</i></td>
1198     <td valign="top">negate all pixels above the threshold level</td>
1199   </tr>
1200
1201   <tr>
1202     <td valign="top">SparseColor</td>
1203     <td valign="top">points=&gt;<i>array of float values</i>, method=&gt;{Barycentric, Bilinear, Shepards, Voronoi}, virtual-pixel=&gt;{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}</td>
1204     <td valign="top">interpolate the image colors around the supplied points</td>
1205   </tr>
1206
1207   <tr>
1208     <td valign="top">Splice</td>
1209     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, fuzz=&gt;<i>double</i>, background=&gt;<i><a href="color.html">color name</a></i>, gravity=&gt;{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td>
1210     <td valign="top">splice an image</td>
1211   </tr>
1212
1213   <tr>
1214     <td valign="top">Spread</td>
1215     <td valign="top">radius=&gt;<i>double</i>, interpolate=&gt;{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}</td>
1216     <td valign="top">displace image pixels by a random amount</td>
1217   </tr>
1218
1219   <tr>
1220     <td valign="top">Statistic</td>
1221     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, type=&gt;{Median, Mode, Mean, Maximum, Minimum, ReduceNoise}</td>
1222     <td valign="top">replace each pixel with corresponding statistic from the neighborhood.</td>
1223   </tr>
1224   <tr>
1225     <td valign="top">Stegano</td>
1226     <td valign="top">image=&gt;<i>image-handle</i>, offset=&gt;<i>integer</i></td>
1227     <td valign="top">hide a digital watermark within the image</td>
1228   </tr>
1229
1230   <tr>
1231     <td valign="top">Stereo</td>
1232     <td valign="top">image=&gt;<i>image-handle</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i></td>
1233     <td valign="top">composites two images and produces a single image that is the composite of a left and right image of a stereo pair</td>
1234   </tr>
1235
1236   <tr>
1237     <td valign="top">Strip</td>
1238     <td valign="top"><br /></td>
1239     <td valign="top">strip an image of all profiles and comments.</td>
1240   </tr>
1241
1242   <tr>
1243     <td valign="top">Swirl</td>
1244     <td valign="top">degrees=&gt;<i>double</i>, interpolate=&gt;{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}</td>
1245     <td valign="top">swirl image pixels about the center</td>
1246   </tr>
1247
1248   <tr>
1249     <td valign="top">Texture</td>
1250     <td valign="top">texture=&gt;<i>image-handle</i></td>
1251     <td valign="top">name of texture to tile onto the image background</td>
1252   </tr>
1253
1254   <tr>
1255     <td valign="top">Thumbnail</td>
1256     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i></td>
1257     <td valign="top">changes the size of an image to the given dimensions and removes any associated profiles.</td>
1258   </tr>
1259
1260   <tr>
1261     <td valign="top">Threshold</td>
1262     <td valign="top">threshold=&gt;<i>string</i>, channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1263     <td valign="top">threshold the image</td>
1264   </tr>
1265
1266   <tr>
1267     <td valign="top">Tint</td>
1268     <td valign="top">fill=&gt;<i><a href="color.html">color name</a></i>, blend=&gt;<i>string</i></td>
1269     <td valign="top">tint the image with the fill color.</td>
1270   </tr>
1271
1272   <tr>
1273     <td valign="top">Transparent</td>
1274     <td valign="top">color=&gt;<i><a href="color.html">color name</a></i>, invert=&gt;{True, False}</td>
1275     <td valign="top">make this color transparent within the image</td>
1276   </tr>
1277
1278   <tr>
1279     <td valign="top">Transpose</td>
1280     <td valign="top"><br /></td>
1281     <td valign="top">flip image in the vertical direction and rotate 90 degrees</td>
1282   </tr>
1283
1284   <tr>
1285     <td valign="top">Transverse</td>
1286     <td valign="top"><br /></td>
1287     <td valign="top">flop image in the horizontal direction and rotate 270 degrees</td>
1288   </tr>
1289
1290   <tr>
1291     <td valign="top">Trim</td>
1292     <td valign="top"><br /></td>
1293     <td valign="top">remove edges that are the background color from the image</td>
1294   </tr>
1295
1296   <tr>
1297     <td valign="top">UnsharpMask</td>
1298     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, amount=&gt;<i>double</i>, threshold=&gt;<i>double</i></td>
1299     <td valign="top">sharpen the image with the unsharp mask algorithm.</td>
1300   </tr>
1301
1302   <tr>
1303     <td valign="top">Vignette</td>
1304     <td valign="top">geometry=&gt;<i>geometry</i>, radius=&gt;<i>double</i>, sigma=&gt;<i>double</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i>, background=&gt;<i><a href="color.html">color name</a></i></td>
1305     <td valign="top">offset the edges of the image in vignette style</td>
1306   </tr>
1307
1308   <tr>
1309     <td valign="top">Wave</td>
1310     <td valign="top">geometry=&gt;<i>geometry</i>, amplitude=&gt;<i>double</i>, wavelength=&gt;<i>double</i>, interpolate=&gt;{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}</td>
1311     <td valign="top">alter an image along a sine wave</td>
1312   </tr>
1313
1314   <tr>
1315     <td valign="top">WhiteThreshold</td>
1316     <td valign="top">threshold=&gt;<i>string</i>, , channel=&gt;{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td>
1317     <td valign="top">force all pixels above the threshold intensity into white</td>
1318   </tr>
1319 </tbody>
1320 </table>
1321
1322 <p>Note, that the <kbd>geometry</kbd> parameter is a short cut for the <kbd>width</kbd> and <kbd>height</kbd> parameters (e.g.  <kbd>geometry=&gt;'106x80'</kbd> is equivalent to <kbd>width=&gt;106, height=&gt;80</kbd> ).</p>
1323
1324 <p>You can specify <kbd>@filename</kbd> in both Annotate() and Draw(). This reads the text or graphic primitive instructions from a file on disk. For example,</p>
1325
1326 <pre class="code">
1327    $image-&gt;Draw(fill=&gt;'red', primitive=&gt;'rectangle',
1328      points=&gt;'20,20 100,100  40,40 200,200  60,60 300,300');
1329 </pre>
1330
1331 <p>Is equivalent to</p>
1332
1333 <pre class="code">
1334    $image-&gt;Draw(fill=&gt;'red', primitive=&gt;'@draw.txt');
1335 </pre>
1336
1337 <p>Where <kbd>draw.txt</kbd> is a file on disk that contains this:</p>
1338
1339 <pre class="text">
1340   rectangle 20, 20 100, 100
1341   rectangle 40, 40 200, 200
1342   rectangle 60, 60 300, 300
1343 </pre>
1344
1345 <p>The <i>text</i> parameter for methods, Annotate(), Comment(), Draw(), and Label() can include the image filename, type, width, height, or other image attribute by embedding these special format characters:</p>
1346
1347 <pre class="text">
1348    %b   file size
1349    %c   comment
1350    %d   directory
1351    %e   filename extension
1352    %f   filename
1353    %g   page geometry
1354    %h   height
1355    %i   input filename
1356    %k   number of unique colors
1357    %l   label
1358    %m   magick
1359    %n   number of scenes
1360    %o   output filename
1361    %p   page number
1362    %q   quantum depth
1363    %r   image class and colorspace
1364    %s   scene number
1365    %t   top of filename
1366    %u   unique temporary filename
1367    %w   width
1368    %x   x resolution
1369    %y   y resolution
1370    %z   image depth
1371    %C   image compression type
1372    %D   image dispose method
1373    %H   page height
1374    %Q   image compression quality
1375    %T   image delay
1376    %W   page width
1377    %X   page x offset
1378    %Y   page y offset
1379    %@   bounding box
1380    %#   signature
1381    %%   a percent sign
1382    \n   newline
1383    \r   carriage return
1384 </pre>
1385
1386 <p>For example,</p>
1387
1388 <pre class="code">
1389   text=&gt;"%m:%f %wx%h"
1390 </pre>
1391
1392 <p>produces an annotation of <b>MIFF:bird.miff 512x480</b> for an image titled <b>bird.miff</b> and whose width is 512 and height is 480.</p>
1393
1394 <p>You can optionally add <i>Image</i> to any method name. For example, TrimImage() is an alias for method Trim().</p>
1395
1396 <p>Most of the attributes listed above have an analog in <a href="convert.html">convert</a>. See the documentation for a more detailed description of these attributes.</p>
1397
1398 </div>
1399
1400 <h2><a id="set-attribute"></a>Set an Image Attribute</h2>
1401 <div class="doc-section">
1402
1403 <p>Use method Set() to set an image attribute. For example,</p>
1404
1405 <pre class="code">
1406   $image-&gt;Set(dither=&gt;'True');
1407   $image-&gt;[$x]-&gt;Set(delay=&gt;3);
1408 </pre>
1409
1410 <p>Where this example uses 'True' and this document says '{True, False}',
1411 you can use the case-insensitive strings 'True' and 'False', or you
1412 can use the integers 1 and 0.</p>
1413
1414 <p>When you call Get() on a Boolean attribute, Image::Magick returns 1 or 0, not a string.</p>
1415
1416 <p>And here is a list of all the image attributes you can set:</p>
1417
1418 <table class="doc">
1419   <caption>Image Attributes</caption>
1420   <tbody>
1421   <tr>
1422     <th>Attribute</th>
1423     <th style="width: 40%">Values</th>
1424     <th style="width: 40%">Description</th>
1425   </tr>
1426
1427   <tr>
1428     <td valign="top">adjoin</td>
1429     <td valign="top">{True, False}</td>
1430     <td valign="top">join images into a single multi-image file</td>
1431   </tr>
1432
1433   <tr>
1434     <td valign="top">alpha</td>
1435     <td valign="top">{On, Off, Opaque, Transparent, Copy, Extract, Set}</td>
1436     <td valign="top">control of and special operations involving the alpha/matte channel</td>
1437   </tr>
1438
1439   <tr>
1440     <td valign="top">antialias</td>
1441     <td valign="top">{True, False}</td>
1442     <td valign="top">remove pixel aliasing</td>
1443   </tr>
1444
1445   <tr>
1446     <td valign="top">area-limit</td>
1447     <td valign="top"><i>integer</i></td>
1448     <td valign="top">set pixel area resource limit.</td>
1449   </tr>
1450
1451   <tr>
1452     <td valign="top">attenuate</td>
1453     <td valign="top"><i>double</i></td>
1454     <td valign="top">lessen (or intensify) when adding noise to an image.</td>
1455   </tr>
1456
1457   <tr>
1458     <td valign="top">authenticate</td>
1459     <td valign="top"><i>string</i></td>
1460     <td valign="top">decrypt image with this password.</td>
1461   </tr>
1462
1463   <tr>
1464     <td valign="top">background</td>
1465     <td valign="top"><i><a href="color.html">color name</a></i></td>
1466     <td valign="top">image background color</td>
1467   </tr>
1468
1469   <tr>
1470     <td valign="top">blue-primary</td>
1471     <td valign="top"><i>x-value</i>, <i>y-value</i></td>
1472     <td valign="top">chromaticity blue primary point (e.g. 0.15, 0.06)</td>
1473   </tr>
1474
1475   <tr>
1476     <td valign="top">bordercolor</td>
1477     <td valign="top"><i><a href="color.html">color name</a></i></td>
1478     <td valign="top">set the image border color</td>
1479   </tr>
1480
1481   <tr>
1482     <td valign="top">clip-mask</td>
1483     <td valign="top"><i>image</i></td>
1484     <td valign="top">associate a clip mask with the image.</td>
1485   </tr>
1486
1487   <tr>
1488     <td valign="top">colormap[<i>i</i>]</td>
1489     <td valign="top"><i><a href="color.html">color name</a></i></td>
1490     <td valign="top">color name (e.g. red) or hex value (e.g. #ccc) at position
1491 <i>i</i></td>
1492   </tr>
1493
1494   <tr>
1495     <td valign="top">comment</td>
1496     <td valign="top"><i>string</i></td>
1497     <td valign="top">set the image comment</td>
1498   </tr>
1499
1500   <tr>
1501     <td valign="top">compression</td>
1502     <td valign="top">{None, BZip, Fax, Group4, JPEG, JPEG2000, LosslessJPEG, LZW, RLE, Zip}</td>
1503     <td valign="top">type of image compression</td>
1504   </tr>
1505
1506   <tr>
1507     <td valign="top">debug</td>
1508     <td valign="top">{All, Annotate, Blob, Cache, Coder, Configure, Deprecate, Draw, Exception, Locale, None, Resource, Transform, X11}</td>
1509     <td valign="top">display copious debugging information</td>
1510   </tr>
1511
1512   <tr>
1513     <td valign="top">delay</td>
1514     <td valign="top"><i>integer</i></td>
1515     <td valign="top">this many 1/100ths of a second must expire before displaying the next image in a sequence</td>
1516   </tr>
1517
1518   <tr>
1519     <td valign="top">density</td>
1520     <td valign="top"><i>geometry</i></td>
1521     <td valign="top">vertical and horizontal resolution in pixels of the image</td>
1522   </tr>
1523
1524   <tr>
1525     <td valign="top">depth</td>
1526     <td valign="top"><i>integer</i></td>
1527     <td valign="top">image depth</td>
1528   </tr>
1529
1530   <tr>
1531     <td valign="top">direction</td>
1532     <td valign="top"><i>{Undefined, right-to-left, left-to-right</i></td>
1533     <td valign="top">render text right-to-left or left-to-right</td>
1534   </tr>
1535
1536   <tr>
1537     <td valign="top">disk-limit</td>
1538     <td valign="top"><i>integer</i></td>
1539     <td valign="top">set disk resource limit</td>
1540   </tr>
1541
1542   <tr>
1543     <td valign="top">dispose</td>
1544     <td valign="top"><i>{Undefined, None, Background, Previous}</i></td>
1545     <td valign="top">layer disposal method</td>
1546   </tr>
1547
1548   <tr>
1549     <td valign="top">dither</td>
1550     <td valign="top">{True, False}</td>
1551     <td valign="top">apply error diffusion to the image</td>
1552   </tr>
1553
1554   <tr>
1555     <td valign="top">display</td>
1556     <td valign="top"><i>string</i></td>
1557     <td valign="top">specifies the X server to contact</td>
1558   </tr>
1559
1560   <tr>
1561     <td valign="top">extract</td>
1562     <td valign="top"><i>geometry</i></td>
1563     <td valign="top">extract area from image</td>
1564   </tr>
1565
1566   <tr>
1567     <td valign="top">file</td>
1568     <td valign="top"><i>filehandle</i></td>
1569     <td valign="top">set the image filehandle</td>
1570   </tr>
1571
1572   <tr>
1573     <td valign="top">filename</td>
1574     <td valign="top"><i>string</i></td>
1575     <td valign="top">set the image filename</td>
1576   </tr>
1577
1578   <tr>
1579     <td valign="top">fill</td>
1580     <td valign="top"><i>color</i></td>
1581     <td valign="top">The fill color paints any areas inside the outline of drawn shape.</td>
1582   </tr>
1583
1584   <tr>
1585     <td valign="top">font</td>
1586     <td valign="top"><i>string</i></td>
1587     <td valign="top">use this font when annotating the image with text</td>
1588   </tr>
1589
1590   <tr>
1591     <td valign="top">fuzz</td>
1592     <td valign="top"><i>integer</i></td>
1593     <td valign="top">colors within this distance are considered equal</td>
1594   </tr>
1595
1596   <tr>
1597     <td valign="top">gamma</td>
1598     <td valign="top"><i>double</i></td>
1599     <td valign="top">gamma level of the image</td>
1600   </tr>
1601
1602   <tr>
1603     <td valign="top">Gravity</td>
1604     <td valign="top">{Forget, NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td>
1605     <td valign="top">type of image gravity</td>
1606   </tr>
1607
1608   <tr>
1609     <td valign="top">green-primary</td>
1610     <td valign="top"><i>x-value</i>, <i>y-value</i></td>
1611     <td valign="top">chromaticity green primary point (e.g. 0.3, 0.6)</td>
1612   </tr>
1613
1614   <tr>
1615     <td valign="top">index[<i>x</i>, <i>y</i>]</td>
1616     <td valign="top"><i>string</i></td>
1617     <td valign="top">colormap index at position (<i>x</i>, <i>y</i>)</td>
1618   </tr>
1619
1620   <tr>
1621     <td valign="top">interlace</td>
1622     <td valign="top">{None, Line, Plane, Partition, JPEG, GIF, PNG}</td>
1623     <td valign="top">the type of interlacing scheme</td>
1624   </tr>
1625
1626   <tr>
1627     <td valign="top">iterations</td>
1628     <td valign="top"><i>integer</i></td>
1629     <td valign="top">add Netscape loop extension to your GIF animation</td>
1630   </tr>
1631
1632   <tr>
1633     <td valign="top">label</td>
1634     <td valign="top"><i>string</i></td>
1635     <td valign="top">set the image label</td>
1636   </tr>
1637
1638   <tr>
1639     <td valign="top">loop</td>
1640     <td valign="top"><i>integer</i></td>
1641     <td valign="top">add Netscape loop extension to your GIF animation</td>
1642   </tr>
1643
1644   <tr>
1645     <td valign="top">magick</td>
1646     <td valign="top"><i>string</i></td>
1647     <td valign="top">set the image format</td>
1648   </tr>
1649
1650   <tr>
1651     <td valign="top">map-limit</td>
1652     <td valign="top"><i>integer</i></td>
1653     <td valign="top">set map resource limit</td>
1654   </tr>
1655
1656   <tr>
1657     <td valign="top">mask</td>
1658     <td valign="top"><i>image</i></td>
1659     <td valign="top">associate a mask with the image.</td>
1660   </tr>
1661
1662   <tr>
1663     <td valign="top">matte</td>
1664     <td valign="top">{True, False}</td>
1665     <td valign="top">enable the image matte channel</td>
1666   </tr>
1667
1668   <tr>
1669     <td valign="top">mattecolor</td>
1670     <td valign="top"><i><a href="color.html">color name</a></i></td>
1671     <td valign="top">set the image matte color</td>
1672   </tr>
1673
1674   <tr>
1675     <td valign="top">memory-limit</td>
1676     <td valign="top"><i>integer</i></td>
1677     <td valign="top">set memory resource limit</td>
1678   </tr>
1679
1680   <tr>
1681     <td valign="top">monochrome</td>
1682     <td valign="top">{True, False}</td>
1683     <td valign="top">transform the image to black and white</td>
1684   </tr>
1685
1686   <tr>
1687     <td valign="top">option</td>
1688     <td valign="top"><i>string</i></td>
1689     <td valign="top">associate an option with an image format (e.g.  option=&gt;'ps:imagemask'</td>
1690   </tr>
1691
1692   <tr>
1693     <td valign="top">orientation</td>
1694     <td valign="top">{top-left, top-right, bottom-right, bottom-left, left-top, right-top, right-bottom, left-bottom}</td>
1695     <td valign="top">image orientation</td>
1696   </tr>
1697
1698   <tr>
1699     <td valign="top">page</td>
1700     <td valign="top">{ Letter, Tabloid, Ledger, Legal, Statement, Executive, A3, A4, A5, B4, B5, Folio, Quarto, 10x14} or <i>geometry</i></td>
1701     <td valign="top">preferred size and location of an image canvas</td>
1702   </tr>
1703
1704   <tr>
1705     <td valign="top">pixel[<i>x</i>, <i>y</i>]</td>
1706     <td valign="top"><i>string</i></td>
1707     <td valign="top">hex value (e.g. #ccc) at position (<i>x</i>, <i>y</i>)</td>
1708   </tr>
1709
1710   <tr>
1711     <td valign="top">pointsize</td>
1712     <td valign="top"><i>integer</i></td>
1713     <td valign="top">pointsize of the Postscript or TrueType font</td>
1714   </tr>
1715
1716   <tr>
1717     <td valign="top">quality</td>
1718     <td valign="top"><i>integer</i></td>
1719     <td valign="top">JPEG/MIFF/PNG compression level</td>
1720   </tr>
1721
1722   <tr>
1723     <td valign="top">red-primary</td>
1724     <td valign="top"><i>x-value</i>, <i>y-value</i></td>
1725     <td valign="top">chromaticity red primary point (e.g. 0.64, 0.33)</td>
1726   </tr>
1727
1728   <tr>
1729     <td valign="top">sampling-factor</td>
1730     <td valign="top"><i>geometry</i></td>
1731     <td valign="top">horizontal and vertical sampling factor</td>
1732   </tr>
1733
1734   <tr>
1735     <td valign="top">scene</td>
1736     <td valign="top"><i>integer</i></td>
1737     <td valign="top">image scene number</td>
1738   </tr>
1739
1740   <tr>
1741     <td valign="top">server</td>
1742     <td valign="top"><i>string</i></td>
1743     <td valign="top">specifies the X server to contact</td>
1744   </tr>
1745
1746   <tr>
1747     <td valign="top">size</td>
1748     <td valign="top"><i>string</i></td>
1749     <td valign="top">width and height of a raw image</td>
1750   </tr>
1751
1752   <tr>
1753     <td valign="top">stroke</td>
1754     <td valign="top"><i>color</i></td>
1755     <td valign="top">The stroke color paints along the outline of a shape.</td>
1756   </tr>
1757
1758   <tr>
1759     <td valign="top">texture</td>
1760     <td valign="top"><i>string</i></td>
1761     <td valign="top">name of texture to tile onto the image background</td>
1762   </tr>
1763
1764   <tr>
1765     <td valign="top">tile-offset</td>
1766     <td valign="top"><i>geometry</i></td>
1767     <td valign="top">image tile offset</td>
1768   </tr>
1769
1770   <tr>
1771     <td valign="top">time-limit</td>
1772     <td valign="top"><i>integer</i></td>
1773     <td valign="top">set time resource limit in seconds</td>
1774   </tr>
1775
1776   <tr>
1777     <td valign="top">type</td>
1778     <td valign="top">{Bilevel, Grayscale, GrayscaleMatte, Palette, PaletteMatte, TrueColor, TrueColorMatte, ColorSeparation, ColorSeparationMatte}</td>
1779     <td valign="top">image type</td>
1780   </tr>
1781
1782   <tr>
1783     <td valign="top">units</td>
1784     <td valign="top">{ Undefined, PixelsPerInch, PixelsPerCentimeter}</td>
1785     <td valign="top">units of image resolution</td>
1786   </tr>
1787
1788   <tr>
1789     <td valign="top">verbose</td>
1790     <td valign="top">{True, False}</td>
1791     <td valign="top">print detailed information about the image</td>
1792   </tr>
1793
1794   <tr>
1795     <td valign="top">virtual-pixel</td>
1796     <td valign="top">{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}</td>
1797     <td valign="top">the virtual pixel method</td>
1798   </tr>
1799
1800   <tr>
1801     <td valign="top">white-point</td>
1802     <td valign="top"><i>x-value</i>, <i>y-value</i></td>
1803     <td valign="top">chromaticity white point (e.g. 0.3127, 0.329)</td>
1804   </tr>
1805   </tbody>
1806 </table>
1807
1808 <p>Note, that the <kbd>geometry</kbd> parameter is a short cut for the <kbd>width</kbd> and <kbd>height</kbd> parameters (e.g.  <kbd>geometry=&gt;'106x80'</kbd> is equivalent to <kbd>width=&gt;106, height=&gt;80</kbd>).</p>
1809
1810 <p>SetAttribute() is an alias for method Set().</p>
1811
1812 <p>Most of the attributes listed above have an analog in
1813 <a href="convert.html">convert</a>. See the documentation for a more detailed description of these attributes.</p>
1814
1815 </div>
1816
1817 <h2><a id="get-attribute"></a>Get an Image Attribute</h2>
1818 <div class="doc-section">
1819
1820 <p>Use method Get() to get an image attribute. For example,</p>
1821
1822 <pre class="code">
1823   ($a, $b, $c) = $image-&gt;Get('colorspace', 'magick', 'adjoin');
1824   $width = $image-&gt;[3]-&gt;Get('columns');
1825 </pre>
1826
1827 <p>In addition to all the attributes listed in <a href="perl-magick.html#set-attribute">Set an Image Attribute</a> , you can get these additional attributes:</p>
1828
1829 <table class="doc">
1830   <caption>Image Attributes</caption>
1831   <tbody>
1832   <tr>
1833     <th>Attribute</th>
1834     <th>Values</th>
1835     <th style="width: 60%">Description</th>
1836   </tr>
1837
1838   <tr>
1839     <td valign="top">area</td>
1840     <td valign="top"><i>integer</i></td>
1841     <td valign="top">current area resource consumed</td>
1842   </tr>
1843
1844   <tr>
1845     <td valign="top">base-columns</td>
1846     <td valign="top"><i>integer</i></td>
1847     <td valign="top">base image width (before transformations)</td>
1848   </tr>
1849
1850   <tr>
1851     <td valign="top">base-filename</td>
1852     <td valign="top"><i>string</i></td>
1853     <td valign="top">base image filename (before transformations)</td>
1854   </tr>
1855
1856   <tr>
1857     <td valign="top">base-rows</td>
1858     <td valign="top"><i>integer</i></td>
1859     <td valign="top">base image height (before transformations)</td>
1860   </tr>
1861
1862   <tr>
1863     <td valign="top">class</td>
1864     <td valign="top">{Direct, Pseudo}</td>
1865     <td valign="top">image class</td>
1866   </tr>
1867
1868   <tr>
1869     <td valign="top">colors</td>
1870     <td valign="top"><i>integer</i></td>
1871     <td valign="top">number of unique colors in the image</td>
1872   </tr>
1873
1874   <tr>
1875     <td valign="top">columns</td>
1876     <td valign="top"><i>integer</i></td>
1877     <td valign="top">image width</td>
1878   </tr>
1879
1880   <tr>
1881     <td valign="top">copyright</td>
1882     <td valign="top"><i>string</i></td>
1883     <td valign="top">get PerlMagick's copyright</td>
1884   </tr>
1885
1886   <tr>
1887     <td valign="top">directory</td>
1888     <td valign="top"><i>string</i></td>
1889     <td valign="top">tile names from within an image montage</td>
1890   </tr>
1891
1892   <tr>
1893     <td valign="top">elapsed-time</td>
1894     <td valign="top"><i>double</i></td>
1895     <td valign="top">elapsed time in seconds since the image was created</td>
1896   </tr>
1897
1898   <tr>
1899     <td valign="top">error</td>
1900     <td valign="top"><i>double</i></td>
1901     <td valign="top">the mean error per pixel computed with methods Compare() or Quantize()</td>
1902   </tr>
1903
1904   <tr>
1905     <td valign="top">bounding-box</td>
1906     <td valign="top"><i>string</i></td>
1907     <td valign="top">image bounding box</td>
1908   </tr>
1909
1910   <tr>
1911     <td valign="top">disk</td>
1912     <td valign="top"><i>integer</i></td>
1913     <td valign="top">current disk resource consumed</td>
1914   </tr>
1915
1916   <tr>
1917     <td valign="top">filesize</td>
1918     <td valign="top"><i>integer</i></td>
1919     <td valign="top">number of bytes of the image on disk</td>
1920   </tr>
1921
1922   <tr>
1923     <td valign="top">format</td>
1924     <td valign="top"><i>string</i></td>
1925     <td valign="top">get the descriptive image format</td>
1926   </tr>
1927
1928   <tr>
1929     <td valign="top">geometry</td>
1930     <td valign="top"><i>string</i></td>
1931     <td valign="top">image geometry</td>
1932   </tr>
1933
1934   <tr>
1935     <td valign="top">height</td>
1936     <td valign="top"><i>integer</i></td>
1937     <td valign="top">the number of rows or height of an image</td>
1938   </tr>
1939
1940   <tr>
1941     <td valign="top">id</td>
1942     <td valign="top"><i>integer</i></td>
1943     <td valign="top">ImageMagick registry id</td>
1944   </tr>
1945
1946   <tr>
1947     <td valign="top">mean-error</td>
1948     <td valign="top"><i>double</i></td>
1949     <td valign="top">the normalized mean error per pixel computed with methods Compare() or Quantize()</td>
1950   </tr>
1951
1952   <tr>
1953     <td valign="top">map</td>
1954     <td valign="top"><i>integer</i></td>
1955     <td valign="top">current memory-mapped resource consumed</td>
1956   </tr>
1957
1958   <tr>
1959     <td valign="top">matte</td>
1960     <td valign="top">{True, False}</td>
1961     <td valign="top">whether or not the image has a matte channel</td>
1962   </tr>
1963
1964   <tr>
1965     <td valign="top">maximum-error</td>
1966     <td valign="top"><i>double</i></td>
1967     <td valign="top">the normalized max error per pixel computed with methods Compare() or Quantize()</td>
1968   </tr>
1969
1970   <tr>
1971     <td valign="top">memory</td>
1972     <td valign="top"><i>integer</i></td>
1973     <td valign="top">current memory resource consumed</td>
1974   </tr>
1975
1976   <tr>
1977     <td valign="top">mime</td>
1978     <td valign="top"><i>string</i></td>
1979     <td valign="top">MIME of the image format</td>
1980   </tr>
1981
1982   <tr>
1983     <td valign="top">montage</td>
1984     <td valign="top"><i>geometry</i></td>
1985     <td valign="top">tile size and offset within an image montage</td>
1986   </tr>
1987
1988   <tr>
1989     <td valign="top">page.x</td>
1990     <td valign="top"><i>integer</i></td>
1991     <td valign="top">x offset of image virtual canvas</td>
1992   </tr>
1993
1994   <tr>
1995     <td valign="top">page.y</td>
1996     <td valign="top"><i>integer</i></td>
1997     <td valign="top">y offset of image virtual canvas</td>
1998   </tr>
1999
2000   <tr>
2001     <td valign="top">rows</td>
2002     <td valign="top"><i>integer</i></td>
2003     <td valign="top">the number of rows or height of an image</td>
2004   </tr>
2005
2006   <tr>
2007     <td valign="top">signature</td>
2008     <td valign="top"><i>string</i></td>
2009     <td valign="top">SHA-256 message digest associated with the image pixel stream</td>
2010   </tr>
2011
2012   <tr>
2013     <td valign="top">taint</td>
2014     <td valign="top">{True, False}</td>
2015     <td valign="top">True if the image has been modified</td>
2016   </tr>
2017
2018   <tr>
2019     <td valign="top">total-ink-density</td>
2020     <td valign="top"><i>double</i></td>
2021     <td valign="top">returns the total ink density for a CMYK image</td>
2022   </tr>
2023
2024   <tr>
2025     <td valign="top">transparent-color</td>
2026     <td valign="top"><i><a href="color.html">color name</a></i></td>
2027     <td valign="top">set the image transparent color</td>
2028   </tr>
2029
2030   <tr>
2031     <td valign="top">user-time</td>
2032     <td valign="top"><i>double</i></td>
2033     <td valign="top">user time in seconds since the image was created</td>
2034   </tr>
2035
2036   <tr>
2037     <td valign="top">version</td>
2038     <td valign="top"><i>string</i></td>
2039     <td valign="top">get PerlMagick's version</td>
2040   </tr>
2041
2042   <tr>
2043     <td valign="top">width</td>
2044     <td valign="top"><i>integer</i></td>
2045     <td valign="top">the number of columns or width of an image</td>
2046   </tr>
2047
2048   <tr>
2049     <td valign="top">x-resolution</td>
2050     <td valign="top"><i>integer</i></td>
2051     <td valign="top">x resolution of the image</td>
2052   </tr>
2053
2054   <tr>
2055     <td valign="top">y-resolution</td>
2056     <td valign="top"><i>integer</i></td>
2057     <td valign="top">y resolution of the image</td>
2058   </tr>
2059   </tbody>
2060 </table>
2061
2062 <p>GetAttribute() is an alias for method Get().</p>
2063
2064 <p>Most of the attributes listed above have an analog in
2065 <a href="convert.html">convert</a>. See the documentation for a more detailed description of these attributes.</p>
2066
2067 </div>
2068
2069 <h2><a id="compare"></a>Compare an Image to its Reconstruction</h2>
2070 <div class="doc-section">
2071 </div>
2072
2073 <p>Mathematically and visually annotate the difference between an image and its reconstruction with the Compare() method.  The method supports these parameters:</p>
2074
2075 <table class="doc">
2076   <caption>Compare Parameters</caption>
2077   <tbody>
2078   <tr>
2079     <th>Parameter</th>
2080     <th style="width: 40%">Values</th>
2081     <th style="width: 40%">Description</th>
2082   </tr>
2083
2084   <tr>
2085     <td valign="top">channel</td>
2086     <td valign="top"><i>double</i></td>
2087     <td valign="top">select image channels, the default is all channels except alpha.</td>
2088   </tr>
2089
2090   <tr>
2091     <td valign="top">fuzz</td>
2092     <td valign="top"><i>double</i></td>
2093     <td valign="top">colors within this distance are considered equal</td>
2094   </tr>
2095
2096   <tr>
2097     <td valign="top">image</td>
2098     <td valign="top"><i>image-reference</i></td>
2099     <td valign="top">the image reconstruction</td>
2100   </tr>
2101
2102   <tr>
2103     <td valign="top">metric</td>
2104     <td valign="top">AE, MAE, MEPP, MSE, PAE, PSNR, RMSE</td>
2105     <td valign="top">measure differences between images with this metric</td>
2106   </tr>
2107   </tbody>
2108 </table>
2109
2110 <p>In this example, we compare the ImageMagick logo to a sharpened reconstruction:</p>
2111
2112 <pre class="code">
2113   use Image::Magick;
2114
2115   $logo=Image::Magick->New();
2116   $logo->Read('logo:');
2117   $sharp=Image::Magick->New();
2118   $sharp->Read('logo:');
2119   $sharp->Sharpen('0x1');
2120   $difference=$logo->Compare(image=>$sharp, metric=>'rmse');
2121   print $difference->Get('error'), "\n";
2122   $difference->Display();
2123 </pre>
2124
2125 <p>In addition to the reported root mean squared error of around 0.024, a difference image is displayed so you can visually identify the difference between the images.</p>
2126
2127 <h2><a id="montage"></a>Create an Image Montage</h2>
2128 <div class="doc-section">
2129
2130 <p>Use method Montage() to create a composite image by combining several separate images. The images are tiled on the composite image with the name of the image optionally appearing just below the individual tile. For example,</p>
2131
2132 <pre class="code">
2133   $image-&gt;Montage(geometry=&gt;'160x160', tile=&gt;'2x2', texture=&gt;'granite:');
2134 </pre>
2135
2136 <p>And here is a list of Montage() parameters you can set:</p>
2137
2138 <table class="doc">
2139   <caption>Montage Parameters</caption>
2140   <tbody>
2141   <tr>
2142     <th>Parameter</th>
2143     <th style="width: 40%">Values</th>
2144     <th style="width: 40%">Description</th>
2145   </tr>
2146
2147   <tr>
2148     <td valign="top">background</td>
2149     <td valign="top"><i><a href="color.html">color name</a></i></td>
2150     <td valign="top">background color name</td>
2151   </tr>
2152
2153   <tr>
2154     <td valign="top">border</td>
2155     <td valign="top"><i>integer</i></td>
2156     <td valign="top">image border width</td>
2157   </tr>
2158
2159   <tr>
2160     <td valign="top">filename</td>
2161     <td valign="top"><i>string</i></td>
2162     <td valign="top">name of montage image</td>
2163   </tr>
2164
2165   <tr>
2166     <td valign="top">fill</td>
2167     <td valign="top"><a href="color.html">color name</a></td>
2168     <td valign="top">fill color for annotations</td>
2169   </tr>
2170
2171   <tr>
2172     <td valign="top">font</td>
2173     <td valign="top"><i>string</i></td>
2174     <td valign="top">X11 font name</td>
2175   </tr>
2176
2177   <tr>
2178     <td valign="top">frame</td>
2179     <td valign="top"><i>geometry</i></td>
2180     <td valign="top">surround the image with an ornamental border</td>
2181   </tr>
2182
2183   <tr>
2184     <td valign="top">geometry</td>
2185     <td valign="top"><i>geometry</i></td>
2186     <td valign="top">preferred tile and border size of each tile of the composite
2187 image (e.g. 120x120+4+3>)</td>
2188   </tr>
2189
2190   <tr>
2191     <td valign="top">gravity</td>
2192     <td valign="top">NorthWest, North, NorthEast, West, Center, East, SouthWest,
2193 South, SouthEast</td>
2194     <td valign="top">direction image gravitates to within a tile</td>
2195   </tr>
2196
2197   <tr>
2198     <td valign="top">label</td>
2199     <td valign="top"><i>string</i></td>
2200     <td valign="top">assign a label to an image</td>
2201   </tr>
2202
2203   <tr>
2204     <td valign="top">mode</td>
2205     <td valign="top">Frame, Unframe, Concatenate</td>
2206     <td valign="top">thumbnail framing options</td>
2207   </tr>
2208
2209   <tr>
2210     <td valign="top">pointsize</td>
2211     <td valign="top"><i>integer</i></td>
2212     <td valign="top">pointsize of the Postscript or TrueType font</td>
2213   </tr>
2214
2215   <tr>
2216     <td valign="top">shadow</td>
2217     <td valign="top">{True, False}</td>
2218     <td valign="top">add a shadow beneath a tile to simulate depth</td>
2219   </tr>
2220
2221   <tr>
2222     <td valign="top">stroke</td>
2223     <td valign="top"><a href="color.html">color name</a></td>
2224     <td valign="top">stroke color for annotations</td>
2225   </tr>
2226
2227   <tr>
2228     <td valign="top">texture</td>
2229     <td valign="top"><i>string</i></td>
2230     <td valign="top">name of texture to tile onto the image background</td>
2231   </tr>
2232
2233   <tr>
2234     <td valign="top">tile</td>
2235     <td valign="top"><i>geometry</i></td>
2236     <td valign="top">the number of tiles per row and page (e.g. 6x4)</td>
2237   </tr>
2238
2239   <tr>
2240     <td valign="top">title</td>
2241     <td valign="top">string</td>
2242     <td valign="top">assign a title to the image montage</td>
2243   </tr>
2244
2245   <tr>
2246     <td valign="top">transparent</td>
2247     <td valign="top"><i>string</i></td>
2248     <td valign="top">make this color transparent within the image</td>
2249   </tr>
2250   </tbody>
2251 </table>
2252
2253 <p>Note, that the <kbd>geometry</kbd> parameter is a short cut for the <kbd>width</kbd> and <kbd>height</kbd> parameters (e.g.  <kbd>geometry=&gt;'106x80'</kbd> is equivalent to <kbd>width=&gt;106, height=&gt;80</kbd>).</p>
2254
2255 <p>MontageImage() is an alias for method Montage().</p>
2256
2257 <p>Most of the attributes listed above have an analog in <a href="montage.html">montage</a>. See the documentation for a more detailed description of these attributes.</p>
2258
2259 </div>
2260
2261 <h2><a id="blobs"></a>Working with Blobs</h2>
2262 <div class="doc-section">
2263
2264 <p>A blob contains data that directly represent a particular image
2265 format in memory instead of on disk. PerlMagick supports
2266 blobs in any of these image <a href="formats.html">formats</a> and provides methods to convert a blob to or from a particular image format.</p>
2267
2268 <table class="doc">
2269   <caption>Blob Methods</caption>
2270   <tbody>
2271   <tr>
2272     <th>Method</th>
2273     <th>Parameters</th>
2274     <th>Return Value</th>
2275     <th>Description</th>
2276   </tr>
2277
2278   <tr>
2279     <td valign="top">ImageToBlob</td>
2280     <td valign="top">any image <a href="perl-magick.html#set-attribute">attribute</a></td>
2281     <td valign="top">an array of image data in the respective image format</td>
2282     <td valign="top">convert an image or image sequence to an array of blobs</td>
2283   </tr>
2284
2285   <tr>
2286     <td valign="top">BlobToImage</td>
2287     <td valign="top">one or more blobs</td>
2288     <td valign="top">the number of blobs converted to an image</td>
2289     <td valign="top">convert one or more blobs to an image</td>
2290   </tr>
2291   </tbody>
2292 </table>
2293
2294 <p>ImageToBlob() returns the image data in their respective formats. You can then print it, save it to an ODBC database, write it to a file, or pipe it to a display program:</p>
2295
2296 <pre class="code">
2297   @blobs = $image-&gt;ImageToBlob();
2298   open(DISPLAY,"| display -") || die;
2299   binmode DISPLAY;
2300   print DISPLAY $blobs[0];
2301   close DISPLAY;
2302 </pre>
2303
2304 <p>Method BlobToImage() returns an image or image sequence converted from the supplied blob:</p>
2305
2306 <pre class="code">
2307   @blob=$db-&gt;GetImage();
2308   $image=Image::Magick-&gt;new(magick=&gt;'jpg');
2309   $image-&gt;BlobToImage(@blob);
2310 </pre>
2311
2312 </div>
2313
2314 <h2><a id="direct-access"></a>Direct-access to Image Pixels</h2>
2315 <div class="doc-section">
2316
2317 <p>Use these methods to obtain direct access to the image pixels:</p>
2318
2319 <table class="doc">
2320 <caption>Direct-access to Image Pixels</caption>
2321 <tbody>
2322   <tr>
2323     <th>Method</th>
2324     <th>Parameters</th>
2325     <th style="width: 50%">Description</th>
2326   </tr>
2327
2328   <tr>
2329     <td valign="top">GetAuthenticPixels</td>
2330     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i></td>
2331     <td valign="top">return image pixels as a C pointer</td>
2332   </tr>
2333
2334   <tr>
2335     <td valign="top">GetVirtualPixels</td>
2336     <td valign="top">geometry=&gt;<i>geometry</i>, width=&gt;<i>integer</i>, height=&gt;<i>integer</i>, x=&gt;<i>integer</i>, y=&gt;<i>integer</i></td>
2337     <td valign="top">return image pixels as a const C pointer</td>
2338   </tr>
2339
2340   <tr>
2341     <td valign="top">GetAuthenticIndexQueue</td>
2342     <td valign="top"></td>
2343     <td valign="top">return image indexes as a C pointer</td>
2344   </tr>
2345
2346   <tr>
2347     <td valign="top">GetVirtualIndexQueue</td>
2348     <td valign="top"></td>
2349     <td valign="top">return image indexes as a const C pointer</td>
2350   </tr>
2351
2352   <tr>
2353     <td valign="top">SyncAuthenticPixels</td>
2354     <td valign="top"></td>
2355     <td valign="top">sync image pixels to pixel cache</td>
2356   </tr>
2357
2358 </tbody>
2359 </table>
2360
2361 </div>
2362
2363 <h2><a id="miscellaneous"></a>Miscellaneous Methods</h2>
2364 <div class="doc-section">
2365
2366 <p>The Append() method append a set of images. For example,</p>
2367
2368 <pre class="code">
2369   $p = $image-&gt;Append(stack=&gt;{true,false});
2370 </pre>
2371
2372 <p>appends all the images associated with object <kbd>$image</kbd>. By default, images are stacked left-to-right. Set <kbd>stack</kbd> to True to stack them top-to-bottom.</p>
2373
2374 <p>The Clone() method copies a set of images. For example,</p>
2375
2376 <pre class="code">
2377   $q = $p-&gt;Clone();
2378 </pre>
2379
2380 <p>copies all the images from object <kbd>$p</kbd> to <kbd>$q</kbd>. You can use this method for single or multi-image sequences.</p>
2381
2382 <p>The EvaluateImages() method applies an arithemtic, logical or relational expression to a set of images. For example,</p>
2383
2384 <pre class="code">
2385   $p = $image-&gt;EvaluateImages('mean');
2386 </pre>
2387
2388 <p>averages all the images associated with object <kbd>$image</kbd>.</p>
2389
2390 <p>The Features() method returns features for each channel in the image in each of four directions (horizontal, vertical, left and right diagonals) for the specified distance.  The features include the angular second momentum, contrast, correlation, sum of squares: variance, inverse difference moment, sum average, sum varience, sum entropy, entropy, difference variance, difference entropy, information measures of correlation 1, information measures of correlation 2, and maximum correlation coefficient.  Values in RGB, CMYK, RGBA, or CMYKA order (depending on the image type).</p>
2391
2392 <pre class="code">
2393   @features = $image-&gt;Features(1);
2394 </pre>
2395
2396 <p>Finally, the Transform() method accepts a fully-qualified geometry specification for cropping or resizing one or more images.  For example,</p>
2397
2398 <pre class="code">
2399   $p = $images-&gt;Transform(crop=>'100x100+10+60');
2400 </pre>
2401
2402 <p>The Flatten() method flattens a set of images and returns it. For example,</p>
2403
2404 <pre class="code">
2405   $p = $images-&gt;Flatten(background=&gt;'none');
2406   $p-&gt;Write('flatten.png');
2407 </pre>
2408
2409 <p>The sequence of images is replaced by a single image created by composing each image after the first over the first image.</p>
2410
2411 <p>The Fx() method applies a mathematical expression to a set of images and returns the results. For example,</p>
2412
2413 <pre class="code">
2414   $p = $image-&gt;Fx(expression=&gt;'(g+b)/2.0',channel=&gt;'red');
2415   $p-&gt;Write('fx.miff');
2416 </pre>
2417
2418 <p>replaces the red channel with the average of the green and blue channels.</p>
2419
2420 <p>See <a href="fx.html">FX, The Special Effects Image Operator</a> for a detailed discussion of this method.</p>
2421
2422 <p>Histogram() returns the unique colors in the image and a count for each one. The returned values are an array of red, green, blue, opacity, and count values.</p>
2423
2424 <p>The Morph() method morphs a set of images. Both the image pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one image to the next:</p>
2425
2426 <pre class="code">
2427   $p = $image-&gt;Morph(frames=&gt;<i>integer</i>);
2428 </pre>
2429
2430 <p>where <i>frames</i> is the number of in-between images to generate.  The default is 1.</p>
2431
2432 <p>Mosaic() creates an mosaic from an image sequence.</p>
2433
2434 <p>Method Mogrify() is a single entry point for the image manipulation methods (<a href="perl-magick.html#manipulate">Manipulate an Image</a>). The parameters are the name of a method followed by any parameters the method may require. For example, these calls are equivalent:</p>
2435
2436 <pre class="code">
2437   $image-&gt;Crop('340x256+0+0');
2438   $image-&gt;Mogrify('crop', '340x256+0+0');
2439 </pre>
2440
2441 <p>Method MogrifyRegion() applies a transform to a region of the image. It is similar to Mogrify() but begins with the region geometry. For example, suppose you want to brighten a 100x100 region of your image at location (40, 50):</p>
2442
2443 <pre class="code">
2444   $image-&gt;MogrifyRegion('100x100+40+50', 'modulate', brightness=&gt;50);
2445 </pre>
2446
2447 <p>Ping() is a convenience method that returns information about an image without having to read the image into memory. It returns the width, height, file size in bytes, and the file format of the image. You can specify more than one filename but only one filehandle:</p>
2448
2449 <pre class="code">
2450   ($width, $height, $size, $format) = $image-&gt;Ping('logo.png');
2451   ($width, $height, $size, $format) = $image-&gt;Ping(file=&gt;\*IMAGE);
2452   ($width, $height, $size, $format) = $image-&gt;Ping(blob=&gt;$blob);
2453 </pre>
2454
2455 <p>This a more efficient and less memory intensive way to query if an image exists and what its characteristics are.  <kbd>PreviewImage()</kbd> tiles 9 thumbnails of the specified image with an image processing operation applied at varying strengths. This may be helpful pin-pointing an appropriate parameter for a particular image processing operation. Choose from these operations: <kbd>Rotate, Shear, Roll, Hue, Saturation, Brightness, Gamma, Spiff, Dull, Grayscale, Quantize, Despeckle, ReduceNoise, AddNoise, Sharpen, Blur, Threshold, EdgeDetect, Spread, Solarize, Shade, Raise, Segment, Swirl, Implode, Wave, OilPaint, CharcoalDrawing, JPEG</kbd>. Here is an example:</p>
2456
2457 <pre class="code">
2458   $preview = $image-&gt;Preview('Gamma');
2459   $preview-&gt;Display();
2460 </pre>
2461
2462 <p>To have full control over text positioning you need font metric information. Use</p>
2463
2464 <pre class="code">
2465   ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance)
2466          = $image-&gt;QueryFontMetrics(<i>parameters</i>);
2467 </pre>
2468
2469 <p>Where <i>parameters</i> is any parameter of the <a href="perl-magick.html#manipulate">Annotate</a> method. The return values are:</p>
2470
2471 <ul>
2472   <li>character width</li>
2473   <li>character height</li>
2474   <li>ascender</li>
2475   <li>descender</li>
2476   <li>text width</li>
2477   <li>text height</li>
2478   <li>maximum horizontal advance</li>
2479   <li>bounds: x1</li>
2480   <li>bounds: y1</li>
2481   <li>bounds: x2</li>
2482   <li>bounds: y2</li>
2483   <li>origin: x</li>
2484   <li>origin: y</li>
2485 </ul>
2486
2487 <p>Use QueryMultilineFontMetrics() to get the maximum text width and height for multiple lines of text.</p>
2488
2489 <p>Call QueryColor() with no parameters to return a list of known colors names or specify one or more color names to get these attributes: red, green, blue, and opacity value.</p>
2490
2491 <pre class="code">
2492   @colors = $image-&gt;QueryColor();
2493   ($red, $green, $blue, $opacity) = $image-&gt;QueryColor('cyan');
2494   ($red, $green, $blue, $opacity) = $image-&gt;QueryColor('#716bae');
2495 </pre>
2496
2497 <p>QueryColorname() accepts a color value and returns its respective name or hex value;</p>
2498
2499 <pre class="code">
2500     $name = $image-&gt;QueryColorname('rgba(80,60,0,0)');
2501 </pre>
2502
2503 <p>Call QueryFont() with no parameters to return a list of known fonts or specify one or more font names to get these attributes: font name, description, family, style, stretch, weight, encoding, foundry, format, metrics, and glyphs values.</p>
2504
2505 <pre class="code">
2506   @fonts = $image-&gt;QueryFont();
2507   $weight = ($image-&gt;QueryFont('Helvetica'))[5];
2508 </pre>
2509
2510 <p>Call QueryFormat() with no parameters to return a list of known image formats or specify one or more format names to get these attributes: adjoin, blob support, raw, decoder, encoder, description, and module.</p>
2511
2512 <pre class="code">
2513   @formats = $image-&gt;QueryFormat();
2514   ($adjoin, $blob_support, $raw, $decoder, $encoder, $description, $module)
2515             = $image-&gt;QueryFormat('gif');
2516 </pre>
2517
2518 <p>Call MagickToMime() with the image format name to get its MIME type such as <kbd>images/tiff</kbd> from <kbd>tif</kbd>.</p>
2519
2520 <pre class="code">
2521   $mime = $image-&gt;MagickToMime('tif');
2522 </pre>
2523
2524 <p>Use RemoteCommand() to send a command to an already running <a href="display.html">display</a> or <a href="animate.html">animate</a> application. The only parameter is the name of the image file to display or animate.</p>
2525
2526 <pre class="code">
2527   $image-&gt;RemoteCommand('image.jpg');
2528 </pre>
2529
2530 <p>The Smush() method smushes a set of images together. For example,</p>
2531
2532 <pre class="code">
2533   $p = $image-&gt;Smush(stack=&gt;{true,false},offset=&gt;<em>integer</em>);
2534 </pre>
2535
2536 <p>smushes together all the images associated with object <kbd>$image</kbd>. By default, images are smushed left-to-right. Set <kbd>stack</kbd> to True to smushed them top-to-bottom.</p>
2537
2538 <p>Statistics() returns the image statistics for each channel in the image. The returned values are an array of depth, minima, maxima, mean, standard deviation, kurtosis, and skewness values in RGB, CMYK, RGBA, or CMYKA order (depending on the image type).</p>
2539
2540 <pre class="code">
2541   @statistics = $image-&gt;Statistics();
2542 </pre>
2543
2544 <p>Finally, the Transform() method accepts a fully-qualified geometry specification for cropping or resizing one or more images.  For example,</p>
2545
2546 <pre class="code">
2547   $p = $image-&gt;Transform(crop=&gt;'100x100+0+0');
2548 </pre>
2549
2550 <p>You can optionally add <i>Image</i> to any method name above. For example, PingImage() is an alias for method Ping().</p>
2551
2552 </div>
2553
2554 <h2><a id="exceptions"></a>Handling Exceptions</h2>
2555 <div class="doc-section">
2556
2557 <p>All PerlMagick methods return an undefined string context upon success. If any problems occur, the error is returned as a string with an embedded numeric status code. A status code less than 400 is a warning. This means that the operation did not complete but was recoverable to some degree. A numeric code greater or equal to 400 is an error and indicates the operation failed completely. Here is how exceptions are returned for the different methods:</p>
2558
2559 <p>Methods which return a number (e.g. Read(), Write()):</p>
2560
2561 <pre class="code">
2562   $x = $image-&gt;Read(...);
2563   warn "$x" if "$x";      # print the error message
2564   $x =~ /(\d+)/;
2565   print $1;               # print the error number
2566   print 0+$x;             # print the number of images read
2567 </pre>
2568
2569 <p>Methods which operate on an image (e.g. Resize(), Crop()):</p>
2570
2571 <pre class="code">
2572   $x = $image-&gt;Crop(...);
2573   warn "$x" if "$x";      # print the error message
2574   $x =~ /(\d+)/;
2575   print $1;               # print the error number
2576 </pre>
2577
2578 <p>Methods which return images (EvaluateSequence(), Montage(), Clone()) should be checked for errors this way:</p>
2579
2580 <pre class="code">
2581   $x = $image-&gt;Montage(...);
2582   warn "$x" if !ref($x);  # print the error message
2583   $x =~ /(\d+)/;
2584   print $1;               # print the error number
2585 </pre>
2586
2587 <p>Here is an example error message:</p>
2588
2589 <pre class="code">
2590   Error 400: Memory allocation failed
2591 </pre>
2592
2593 <p>Review the complete list of <a href="exception.html">error and warning codes</a>.</p>
2594
2595 <p>The following illustrates how you can use a numeric status code:</p>
2596
2597 <pre class="code">
2598   $x = $image-&gt;Read('rose.png');
2599   $x =~ /(\d+)/;
2600   die "unable to continue" if ($1 == ResourceLimitError);
2601 </pre>
2602
2603 </div>
2604
2605 <h2><a id="constants"></a>Constants</h2>
2606 <div class="doc-section">
2607
2608 <p>PerlMagick includes these constants:</p>
2609
2610 <pre class="text">
2611   BlobError
2612   BlobWarning
2613   CacheError
2614   CacheWarning
2615   CoderError
2616   CoderWarning
2617   ConfigureError
2618   ConfigureWarning
2619   CorruptImageError
2620   CorruptImageWarning
2621   DelegateError
2622   DelegateWarning
2623   DrawError
2624   DrawWarning
2625   ErrorException
2626   FatalErrorException
2627   FileOpenError
2628   FileOpenWarning
2629   ImageError
2630   ImageWarning
2631   MissingDelegateError
2632   MissingDelegateWarning
2633   ModuleError
2634   ModuleWarning
2635   Opaque
2636   OptionError
2637   OptionWarning
2638   QuantumDepth
2639   QuantumRange
2640   RegistryError
2641   RegistryWarning
2642   ResourceLimitError
2643   ResourceLimitWarning
2644   StreamError
2645   StreamWarning
2646   Success
2647   Transparent
2648   TypeError
2649   TypeWarning
2650   WarningException
2651   XServerError
2652   XServerWarning
2653 </pre>
2654
2655 <p>You can access them like this:</p>
2656
2657 <pre class="code">
2658   Image::Magick-&gt;QuantumDepth
2659 </pre>
2660
2661 </div>
2662 \r
2663 </div>\r
2664 \r
2665 <div id="linkbar">\r
2666     <span id="linkbar-west">&nbsp;</span>\r
2667     <span id="linkbar-center">\r
2668       <a href="../discourse-server">Discourse Server</a> &bull;\r
2669       <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>\r
2670     </span>\r
2671     <span id="linkbar-east">&nbsp;</span>\r
2672   </div>\r
2673   <div class="footer">\r
2674     <span id="footer-west">&copy; 1999-2012 ImageMagick Studio LLC</span>\r
2675     <span id="footer-east"> <a href="contact.html">Contact the Wizards</a></span>\r
2676   </div>\r
2677   <div style="clear: both; margin: 0; width: 100%; "></div>\r
2678   <script type="text/javascript">\r
2679     var _gaq = _gaq || [];\r
2680     _gaq.push(['_setAccount', 'UA-17690367-1']);\r
2681     _gaq.push(['_trackPageview']);\r
2682 \r
2683     (function() {\r
2684       var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\r
2685       ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\r
2686       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\r
2687     })();\r
2688   </script>\r
2689 </body>\r
2690 </html>\r