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