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