Debian Codegraph @

www/perl-magick/index.html

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