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