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