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