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