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