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