Debian Codegraph @

www/perl-magick.html

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