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