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