Current Path : /compat/linux/proc/self/root/usr/local/share/doc/ImageMagick/www/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/self/root/usr/local/share/doc/ImageMagick/www/perl-magick.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css" media="screen,projection"><!-- @import url("../www/magick.css"); --></style> <meta name="verify-v1" content="g222frIIxcQTrvDR3NBRUSKP3AnMNoqxOkIniCEkV7U=" /> <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf" /> <title>ImageMagick: PerlMagick, Perl API for ImageMagick</title> <meta http-equiv="Content-Language" content="en-US"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Reply-to" content="magick-users@imagemagick.org"/> <meta name="Generator" content="PHP"/> <meta name="Keywords" content="perlmagick, perl, api, for, imagemagick, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject"/> <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."/> <meta name="Rating" content="GENERAL"/> <meta name="Robots" content="INDEX, FOLLOW"/> <meta name="Generator" content="ImageMagick Studio LLC"/> <meta name="Author" content="ImageMagick Studio LLC"/> <meta name="Revisit-after" content="2 DAYS"/> <meta name="Resource-type" content="document"/> <meta name="Copyright" content="Copyright (c) 1999-2009 ImageMagick Studio LLC"/> <meta name="Distribution" content="Global"/> <link rel="shortcut icon" href="../images/wand.ico" type="images/vnd.microsoft.icon"/> </head> <body id="www-imagemagick-org"> <div class="titlebar"> <a href="../index.html"> <img src="../images/script.png" alt="[ImageMagick]" style="width: 350px; height: 60px; margin: 28px auto; float: left;" /></a> <a href="http://www.networkredux.com"> <img src="../images/networkredux.png" alt="[sponsor]" style="margin: 45px auto; border: 0px; float: left;" /></a> <a href="http://www.imagemagick.org/discourse-server/"> <img src="../images/logo.jpg" alt="" style="width: 114px; height: 118px; border: 0px; float: right;" /></a> <a href="../index.html"> <img src="../images/sprite.jpg" alt="" style="width: 114px; height: 118px; border: 0px; float: right;" /></a> </div> <div class="eastbar"> <div class="menu"> <a href="../index.html">About ImageMagick</a> </div> <div class="sep"></div> <div class="menu"> <a href="../www/command-line-tools.html">Command-line Tools</a> </div> <div class="sub"> <a href="../www/command-line-processing.html">Processing</a> </div> <div class="sub"> <a href="../www/command-line-options.html">Options</a> </div> <div class="sub"> <a href="http://www.imagemagick.org/Usage/">Usage</a> </div> <div class="menu"> <a href="../www/api.html">Program Interfaces</a> </div> <div class="sub"> <a href="../www/magick-wand.html">MagickWand</a> </div> <div class="sub"> <a href="../www/magick-core.html">MagickCore</a> </div> <div class="sub"> <a href="../www/perl-magick.html">PerlMagick</a> </div> <div class="sub"> <a href="../Magick++/">Magick++</a> </div> <div class="menu"> <a href="../www/architecture.html">Architecture</a> </div> <div class="sep"></div> <div class="menu"> <a href="../www/install-source.html">Install from Source</a> </div> <div class="sub"> <a href="../www/install-source.html#unix">Unix</a> </div> <div class="sub"> <a href="../www/install-source.html#windows">Windows</a> </div> <div class="menu"> <a href="../www/binary-releases.html">Binary Releases</a> </div> <div class="sub"> <a href="../www/binary-releases.html#unix">Unix</a> </div> <div class="sub"> <a href="../www/binary-releases.html#macosx">Mac OS X</a> </div> <div class="sub"> <a href="../www/binary-releases.html#windows">Windows</a> </div> <div class="menu"> <a href="../www/resources.html">Resources</a> </div> <div class="sep"></div> <div class="menu"> <a href="../www/download.html">Download</a> </div> <div class="sep"></div> <div class="menu"> <a href="http://www.imagemagick.org/script/search.php">Search</a> </div><div class="sep"></div> <div class="menu"> <a href="../www/sitemap.html">Site Map</a> </div> <div class="sub"> <a href="../www/links.html">Links</a> </div> <div class="sep"></div> <div class="menu"> <a href="../www/sponsors.html">Sponsors:</a> <div class="sponsbox"> <div class="sponsor"> <a href="http://www.wischmop-shop.de">Wischmop</a><!-- 200905070040+ --> </div> <div class="sponsor"> <a href="http://www.who-sells-it.com/">Free Catalogs</a><!-- 201002010000 --> </div> <div class="sponsor"> <a href="http://www.online-kredit-index.de">Kredit</a><!-- 200905010120 --> </div> <div class="sponsor"> <a href="http://www.posters555.com">Poster</a><!-- 200903010800 --> </div> </div> </div> </div> <div class="main"> <p class="navigation-index">[<a href="#installation">Installation</a> • <a href="#overview">Overview</a> • <a href="#example">Example Script</a> • <a href="#read">Read or Write an Image</a> • <a href="#manipulate">Manipulate an Image</a> • <a href="#set-attribute">Set an Image Attribute</a> • <a href="#get-attribute">Get an Image Attribute</a> • <a href="#montage">Create an Image Montage</a> • <a href="#blobs">Working with Blobs</a> • <a href="#direct-access">Direct-access to Image Pixels</a> • <a href="#miscellaneous">Miscellaneous Methods</a> • <a href="#exceptions">Handling Exceptions</a>• <a href="#constants">Constant</a> ]</p> <a name="introduction"></a> <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.2.0 or above and Perl version 5.005_02 or greater installed on your system for either of these utilities to work.</p> <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> <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> <div style="margin: auto;"> <h2><a name="installation"></a>Installation</h2> </div> <p><b>UNIX</b></p> <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> <p>ImageMagick must already be installed on your system. Next, get the <a href="../www/download.html">PerlMagick</a> distribution corresponding to the installed ImageMagick distribution (e.g. PerlMagick 6.49 for ImageMagick 6.4.9) and unpack it as shown below:</p> <pre class="text"> tar xvfz PerlMagick-6.49.tar.gz cd PerlMagick </pre> <p>Next, edit <kbd>Makefile.PL</kbd> and change LIBS and INC to include the appropriate path information to the required <kbd>libMagick</kbd> library. You will also 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> <pre class="text"> perl Makefile.PL make make install </pre> <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> <p><b>Windows XP / Windows 2000</b></p> <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> <p>Next, type</p> <pre class="text"> cd PerlMagick copy Makefile.nt Makefile.PL perl Makefile.PL nmake nmake install </pre> <p>See the <a href="http://www.dylanbeattie.net/magick/">PerlMagick Windows HowTo</a> page for further installation instructions.</p> <p><b>Running the Regression Tests</b></p> <p>To verify a correct installation, type</p> <pre class="text"> make test </pre> <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> <pre class="text"> cd demo make </pre> <p>You are now ready to utilize the PerlMagick methods from within your Perl scripts.</p> <div style="margin: auto;"> <h2><a name="overview"></a>Overview</h2> </div> <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> <pre class="code"> use Image::Magick; $image=Image::Magick->new; </pre> <p>The new() method takes the same parameters as <a href="#set-attribute">SetAttribute</a> . For example,</p> <pre class="code"> $image=Image::Magick->new(size=>'384x256'); </pre> <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> <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 mega-bytes 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> <pre class="code"> undef $image; </pre> <p>To delete all the images but retain the <kbd>Image::Magick</kbd> object use</p> <pre class="code"> @$image = (); </pre> <p>and finally, to delete a single image from a multi-image sequence, use</p> <pre class="code"> undef $image->[$x]; </pre> <p>The next section illustrates how to use various PerlMagick methods to manipulate an image sequence.</p> <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,</p> <pre class="text"> $ENV{PATH}='/../bin:/usr/bin:/usr/local/bin'; </pre> <div style="margin: auto;"> <h2><a name="example"></a>Example Script</h2> </div> <p>Here is an example script to get you started:</p> <pre class="code"> #!/usr/local/bin/perl use Image::Magick;<br /> my($image, $x);<br /> $image = Image::Magick->new; $x = $image->Read('girl.png', 'logo.png', 'rose.png'); warn "$x" if "$x";<br /> $x = $image->Crop(geometry=>'100x100+100+100'); warn "$x" if "$x";<br /> $x = $image->Write('x.png'); warn "$x" if "$x"; </pre> <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> <pre class="code"> #!/usr/local/bin/perl use Image::Magick;<br /> my($image, $p, $q);<br /> $image = new Image::Magick; $image->Read('x1.png'); $image->Read('j*.jpg'); $image->Read('k.miff[1, 5, 3]'); $image->Contrast(); for ($x = 0; $image->[$x]; $x++) { $image->[$x]->Frame('100x200') if $image->[$x]->Get('magick') eq 'GIF'; undef $image->[$x] if $image->[$x]->Get('columns') < 100; } $p = $image->[1]; $p->Draw(stroke=>'red', primitive=>'rectangle', points=>20,20 100,100'); $q = $p->Montage(); undef $image; $q->Write('x.miff'); </pre> <p>Suppose you want to start out with a 100 by 100 pixel white canvas with a red pixel in the center. Try</p> <pre class="code"> $image = Image::Magick->new; $image->Set(size=>'100x100'); $image->ReadImage('xc:white'); $image->Set('pixel[49,49]'=>'red'); </pre> <p>Here we reduce the intensity of the red component at (1,1) by half:</p> <pre class="code"> @pixels = $image->GetPixel(x=>1,y=>1); $pixels[0]*=0.5; $image->SetPixel(x=>1,y=>1,color=>\@pixels); </pre> <p>Or suppose you want to convert your color image to grayscale:</p> <pre class="code"> $image->Quantize(colorspace=>'gray'); </pre> <p>Let's annotate an image with a Taipai TrueType font:</p> <pre class="code"> $text = 'Works like magick!'; $image->Annotate(font=>'kai.ttf', pointsize=>40, fill=>'green', text=>$text); </pre> <p>Perhaps you want to extract all the pixel intensities from an image and write them to STDOUT:</p> <pre class="code"> @pixels = $image->GetPixels(map=>'I', height=>$height, width=>$width, normalize=>true); binmode STDOUT; print pack('B*',join('',@pixels)); </pre> <p>Other clever things you can do with a PerlMagick objects include</p> <pre class="code"> $i = $#$p"+1"; # return the number of images associated with object p push(@$q, @$p); # push the images from object p onto object q @$p = (); # delete the images but not the object p $p->Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]); # 3x3 Gaussian kernel </pre> <div style="margin: auto;"> <h2><a name="read"></a>Read or Write an Image</h2> </div> <p>Use the methods listed below to either read, write, or display an image or image sequence:</p> <table class="doc"> <caption>Read or Write Methods</caption> <colgroup> <col width="20%"></col> <col width="20%"></col> <col width="20%"></col> <col width="40%"></col> </colgroup> <tbody> <tr> <th>Method</th> <th>Parameters</th> <th>Return Value</th> <th>Description</th> </tr> <tr> <td valign="top">Read</td> <td valign="top">one or more filenames</td> <td valign="top">the number of images read</td> <td valign="top">read an image or image sequence</td> </tr> <tr> <td valign="top">Write</td> <td valign="top">filename</td> <td valign="top">the number of images written</td> <td valign="top">write an image or image sequence</td> </tr> <tr> <td valign="top">Display</td> <td valign="top">server name</td> <td valign="top">the number of images displayed</td> <td valign="top">display the image or image sequence to an X server</td> </tr> <tr> <td valign="top">Animate</td> <td valign="top">server name</td> <td valign="top">the number of images animated</td> <td valign="top">animate image sequence to an X server</td> </tr> </tbody> </table> <p>For convenience, methods Write(), Display(), and Animate() can take any parameter that <a href="#set-attribute">SetAttribute</a> knows about. For example,</p> <pre class="code"> $image->Write(filename=>'image.png', compression=>'None'); </pre> <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> <pre class="code"> binmode STDOUT; $image->Write('png:-'); </pre> <p>To read an image in the GIF format from a PERL filehandle, use:</p> <pre class="code"> $image = Image::Magick->new; open(IMAGE, 'image.gif'); $image->Read(file=>\*IMAGE); close(IMAGE); </pre> <p>To write an image in the PNG format to a PERL filehandle, use:</p> <pre class="code"> $filename = "image.png"; open(IMAGE, ">$filename"); $image->Write(file=>\*IMAGE, filename=>$filename); close(IMAGE); </pre> <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> <pre class="text"> image%03d.miff </pre> <p>converts files image000.miff, image001.miff, etc.</p> <p>You can optionally add <i>Image</i> to any method name. For example, ReadImage() is an alias for method Read().</p> <div style="margin: auto;"> <h2><a name="manipulate"></a>Manipulate an Image</h2> </div> <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> <pre class="code"> $image->Crop(geometry=>'100x100+10+20'); $image->[$x]->Frame("100x200"); </pre> <p>And here is a list of other image manipulation methods you can call:</p> <table class="doc"> <caption>Image Manipulation Methods</caption> <tbody> <tr> <th>Method</th> <th style="width: 40%">Parameters</th> <th style="width: 40%">Description</th> </tr> <tr> <td valign="top">AdaptiveBlur</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <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> </tr> <tr> <td valign="top">AdaptiveResize</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, filter=>{Point, Box, Triangle, Hermite, Hanning, Hamming, Blackman, Gaussian, Quadratic, Cubic, Catrom, Mitchell, Lanczos, Bessel, Sinc}, support=><i>double</i>, blur=><i>double</i></td> <td valign="top">adaptively resize image using data dependant triangulation. Specify <kbd>blur</kbd> > 1 for blurry or < 1 for sharp</td> </tr> <tr> <td valign="top">AdaptiveSharpen</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <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> </tr> <tr> <td valign="top">AdaptiveThreshold</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, offset=><i>integer</i></td> <td valign="top">local adaptive thresholding.</td> </tr> <tr> <td valign="top">AddNoise</td> <td valign="top">noise=>{Uniform, Gaussian, Multiplicative, Impulse, Laplacian, Poisson}, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">add noise to an image</td> </tr> <tr> <td valign="top">AffineTransform</td> <td valign="top">affine=><i>array of float values</i>, translate=><i>float, float</i>, scale=> <i>float, float</i>, rotate=><i>float</i>, skewX=><i>float</i>, skewY=><i>float</i>, interpolate={Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor}, background=><i><a href="../www/color.html">color name</a></i></td> <td valign="top">affine transform image</td> </tr> <tr> <td valign="top">Affinity</td> <td valign="top">image=><i>image-handle</i>, method=>{None, FloydSteinberg, Riemersma}</td> <td valign="top">choose a particular set of colors from this image</td> </tr> <tr> <td valign="top">Annotate</td> <td valign="top">text=><i>string</i>, font=><i>string</i>, family=><i>string</i>, style=>{Normal, Italic, Oblique, Any}, stretch=>{Normal, UltraCondensed, ExtraCondensed, Condensed, SemiCondensed, SemiExpanded, Expanded, ExtraExpanded, UltraExpanded}, weight=><i>integer</i>, pointsize=><i>integer</i>, density=><i>geometry</i>, stroke=><i><a href="../www/color.html">color name</a></i>, strokewidth=><i>integer</i>, fill=><i><a href="../www/color.html">color name</a></i>, undercolor=><i><a href="../www/color.html">color name</a></i>, kerning=><i>float</i>, geometry=><i>geometry</i>, gravity=>{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}, antialias=>{true, false}, x=><i>integer</i>, y=><i>integer</i>, affine=><i>array of float values</i>, translate=><i>float, float</i>, scale=><i>float, float</i>, rotate=><i>float</i>. skewX=><i>float</i>, skewY=> <i>float</i>, align=>{Left, Center, Right}, encoding=>{UTF-8}</td> <td valign="top">annotate an image with text. See <a href="#misc">QueryFontMetrics</a> to get font metrics without rendering any text.</td> </tr> <tr> <td valign="top">AutoOrient</td> <td valign="top"><br /></td> <td valign="top">automatically orient the image</td> </tr> <tr> <td valign="top">BlackThreshold</td> <td valign="top">threshold=><i>string</i></td> <td valign="top">force all pixels below the threshold intensity into black</td> </tr> <tr> <td valign="top">Blur</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">reduce image noise and reduce detail levels with a Gaussian operator of the given radius and standard deviation (sigma).</td> </tr> <tr> <td valign="top">Border</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, bordercolor=><i><a href="../www/color.html">color name</a></i>, compose=>{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> <td valign="top">surround the image with a border of color</td> </tr> <tr> <td valign="top">Charcoal</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i></td> <td valign="top">simulate a charcoal drawing</td> </tr> <tr> <td valign="top">Chop</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i></td> <td valign="top">chop an image</td> </tr> <tr> <td valign="top">Clip</td> <td valign="top">id=><i>name</i>, inside=><i>{true, false}</i>,</td> <td valign="top">apply along a named path from the 8BIM profile.</td> </tr> <tr> <td valign="top">ClipMask</td> <td valign="top">mask=><i>image-handle</i></td> <td valign="top">clip image as defined by the image mask</td> </tr> <tr> <td valign="top">Clut</td> <td valign="top">image=><i>image-handle</i>, channel=>{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td> <td valign="top">apply a color lookup table to an image sequence</td> </tr> <tr> <td valign="top">Coalesce</td> <td valign="top"><br /></td> <td valign="top">merge a sequence of images</td> </tr> <tr> <td valign="top">Colorize</td> <td valign="top">fill=><i><a href="../www/color.html">color name</a></i>, opacity=><i>string</i></td> <td valign="top">colorize the image with the fill color</td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">string</td> <td valign="top">add a comment to your image</td> </tr> <tr> <td valign="top">Compare</td> <td valign="top">image=><i>image-handle</i></td> <td valign="top">compare image to a reference image</td> </tr> <tr> <td valign="top">CompareLayers</td> <td valign="top">method=>{any, clear, overlay}</td> <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> </tr> <tr> <td valign="top">Composite</td> <td valign="top">image=><i>image-handle</i>, compose=>{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=><i>image-handle</i>, geometry=><i>geometry</i>, x=><i>integer</i>, y=><i>integer</i>, gravity=>{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}, opacity=><i>integer</i>, tile=>{True, False}, rotate=><i>double</i>, color=><i><a href="../www/color.html">color name</a></i>, blend=><i>geometry</i>, interpolate=>{undefined, average, bicubic, bilinear, filter, integer, mesh, nearest-neighbor, spline}</td> <td valign="top">composite one image onto another</td> </tr> <tr> <td valign="top">Contrast</td> <td valign="top">sharpen=>{True, False}</td> <td valign="top">enhance or reduce the image contrast</td> </tr> <tr> <td valign="top">ContrastStretch</td> <td valign="top">levels=><i>string</i>, 'black-point'=><i>double</i>, 'white-point'=><i>double</i>, channel=>{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td> <td valign="top">improve the contrast in an image by `stretching' the range of intensity values</td> </tr> <tr> <td valign="top">Convolve</td> <td valign="top">coefficients=><i>array of float values</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, bias=>;<i>double</i></td> <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> </tr> <tr> <td valign="top">Crop</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i>, fuzz=><i>double</i></td> <td valign="top">crop an image</td> </tr> <tr> <td valign="top">CycleColormap</td> <td valign="top">amount=><i>integer</i></td> <td valign="top">displace image colormap by amount</td> </tr> <tr> <td valign="top">Decipher</td> <td valign="top">passphrase=><i>string</i></td> <td valign="top">convert cipher pixels to plain pixels</td> </tr> <tr> <td valign="top">Deconstruct</td> <td valign="top"><br /></td> <td valign="top">break down an image sequence into constituent parts</td> </tr> <tr> <td valign="top">Deskew</td> <td valign="top">geometry=><i>string</i>,threshold=><i>double</i></td> <td valign="top">straighten the image</td> </tr> <tr> <td valign="top">Despeckle</td> <td valign="top"><br /></td> <td valign="top">reduce the speckles within an image</td> </tr> <tr> <td valign="top">Distort</td> <td valign="top">points=><i>array of float values</i>, method=>{Affine, AffineProjection, Bilinear, Perspective, ScaleRotateTranslate}, virtual-pixel=>{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}, best-fit=>{True, False}</td> <td valign="top">distort image</td> </tr> <tr> <td valign="top">Draw</td> <td valign="top">primitive=>{point, line, rectangle, arc, ellipse, circle, path, polyline, polygon, bezier, color, matte, text, @<i>filename</i>}, points=><i>string</i> , method=><i>{Point, Replace, Floodfill, FillToBorder, Reset}</i>, stroke=><i><a href="../www/color.html">color name</a></i>, fill=><i><a href="../www/color.html">color name</a></i>, font=><i>string</i>, pointsize=><i>integer</i>, strokewidth=><i>float</i>, antialias=>{true, false}, bordercolor=><i><a href="../www/color.html">color name</a></i>, x=><i>float</i>, y=><i>float</i>, dash-offset=><i>float</i>, dash-pattern=><i>array of float values</i>, affine=><i>array of float values</i>, translate=><i>float, float</i>, scale=><i>float, float</i>, rotate=><i>float</i>, skewX=><i>float</i>, skewY=><i>float</i>, interpolate=>{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}, kerning=><i>float</i>, text=><i>string</i>, vector-graphics=><i>string</i></td> <td valign="top">annotate an image with one or more graphic primitives.</td> </tr> <tr> <td valign="top">Encipher</td> <td valign="top">passphrase=><i>string</i></td> <td valign="top">convert plain pixels to cipher pixels</td> </tr> <tr> <td valign="top">Edge</td> <td valign="top">radius=><i>double</i></td> <td valign="top">enhance edges within the image with a convolution filter of the given radius.</td> </tr> <tr> <td valign="top">Emboss</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i></td> <td valign="top">emboss the image with a convolution filter of the given radius and standard deviation (sigma).</td> </tr> <tr> <td valign="top">Enhance</td> <td valign="top"><br /></td> <td valign="top">apply a digital filter to enhance a noisy image</td> </tr> <tr> <td valign="top">Equalize</td> <td valign="top">channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}<br /></td> <td valign="top">perform histogram equalization to the image</td> </tr> <tr> <td valign="top">Extent</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i>, fuzz=><i>double</i>, background=><i><a href="../www/color.html">color name</a></i>, gravity=>{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td> <td valign="top">set the image size</td> </tr> <tr> <td valign="top">Evaluate</td> <td valign="top">value=><i>double</i>, operator=><i>{Add, And, Divide, LeftShift, Max, Min, Multiply, Or, Rightshift, Subtract, Xor}</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow} </td> <td valign="top">apply an arithmetic, relational, or logical expression to the image</td> </tr> <tr> <td valign="top">Flip</td> <td valign="top"><br /></td> <td valign="top">reflect the image scanlines in the vertical direction</td> </tr> <tr> <td valign="top">Flop</td> <td valign="top"><br /></td> <td valign="top">reflect the image scanlines in the horizontal direction</td> </tr> <tr> <td valign="top">FloodfillPaint</td> <td valign="top">geometry=><i>geometry</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, x=><i>integer</i>, y=><i>integer</i> , fill=><i><a href="../www/color.html">color name</a></i>, bordercolor=><i><a href="../www/color.html">color name</a></i>, fuzz=><i>double</i>, invert=>{True, False}</td> <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> </tr> <tr> <td valign="top">Frame</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, inner=><i>integer</i>, outer=><i>integer</i>, fill=><i><a href="../www/color.html">color name</a></i>, compose=>{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> <td valign="top">surround the image with an ornamental border</td> </tr> <tr> <td valign="top">Function</td> <td valign="top">parameters=><i>array of float values</i>, function=>{Sin}, virtual-pixel=>{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}</td> <td valign="top">apply a function to the image</td> </tr> <tr> <td valign="top">Gamma</td> <td valign="top">gamma=><i>string</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">gamma correct the image</td> </tr> <tr> <td valign="top">GaussianBlur</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">reduce image noise and reduce detail levels with a Gaussian operator of the given radius and standard deviation (sigma).</td> </tr> <tr> <td valign="top">GetPixel</td> <td valign="top">geometry=><i>geometry</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, normalize=>{true, false}, x=><i>integer</i>, y=><i>integer</i></td> <td valign="top">get a single pixel. By default normalized pixel values are returned.</td> </tr> <tr> <td valign="top">GetPixels</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i>, map=><i>string</i>, normalize=>{true, false}</td> <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> </tr> <tr> <td valign="top">Identify</td> <td valign="top">file=><i>file</i></td> <td valign="top">identify the attributes of an image</td> </tr> <tr> <td valign="top">Implode</td> <td valign="top">amount=><i>double</i>, interpolate=>{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}</td> <td valign="top">implode image pixels about the center</td> </tr> <tr> <td valign="top">Label</td> <td valign="top">string</td> <td valign="top">assign a label to an image</td> </tr> <tr> <td valign="top">Layers</td> <td valign="top">method=>{coalesce, compare-any, compare-clear, compare-over, composite, dispose, flatten, merge, mosaic, optimize, optimize-image, optimize-plus, optimize-trans, remove-dups, remove-zero}, compose=>{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=>{true, false}</td> <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> </tr> <tr> <td valign="top">Level</td> <td valign="top">levels=><i>string</i>, 'black-point'=><i>double</i>, 'gamma'=><i>double</i>, 'white-point'=><i>double</i>, channel=>{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td> <td valign="top">adjust the level of image contrast</td> </tr> <tr> <td valign="top">LinearStretch</td> <td valign="top">levels=><i>string</i>, 'black-point'=><i>double</i>, 'white-point'=><i>double</i></td> <td valign="top">linear with saturation stretch</td> </tr> <tr> <td valign="top">LiquidResize</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, delta-x=><i>double</i>, rigidity=><i>double</i></td> <td valign="top">rescale image with seam-carving.</td> </tr> <tr> <td valign="top">Magnify</td> <td valign="top"><br /></td> <td valign="top">double the size of an image</td> </tr> <tr> <td valign="top">Mask</td> <td valign="top">mask=><i>image-handle</i></td> <td valign="top">composite image pixels as defined by the mask</td> </tr> <tr> <td valign="top">MatteFloodfill</td> <td valign="top">geometry=><i>geometry</i>, x=><i>integer</i>, y=><i>integer</i> , matte=><i>integer</i>, bordercolor=><i><a href="../www/color.html">color name</a></i>, fuzz=><i>double</i>, invert=>{True, False}</td> <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> </tr> <tr> <td valign="top">MedianFilter</td> <td valign="top">radius=><i>double</i></td> <td valign="top">replace each pixel with the median intensity pixel of a neighborhood.</td> </tr> <tr> <td valign="top">Minify</td> <td valign="top"><br /></td> <td valign="top">half the size of an image</td> </tr> <tr> <td valign="top">Modulate</td> <td valign="top">brightness=><i>double</i>, saturation=><i>double</i>, hue=><i>double</i>, lightness=><i>double</i>, whiteness=><i>double</i>, blackness=><i>double</i> </td> <td valign="top">vary the brightness, saturation, and hue of an image by the specified percentage</td> </tr> <tr> <td valign="top">MotionBlur</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, angle=><i>double</i></td> <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> </tr> <tr> <td valign="top">Negate</td> <td valign="top">gray=>{True, False}, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">replace every pixel with its complementary color (white becomes black, yellow becomes blue, etc.)</td> </tr> <tr> <td valign="top">Normalize</td> <td valign="top">channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}<br /></td> <td valign="top">transform image to span the full range of color values</td> </tr> <tr> <td valign="top">OilPaint</td> <td valign="top">radius=><i>integer</i></td> <td valign="top">simulate an oil painting</td> </tr> <tr> <td valign="top">Opaque</td> <td valign="top">color=><i><a href="../www/color.html">color name</a></i>, fill=><i><a href="../www/color.html">color name</a></i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, invert=>{True, False}</td> <td valign="top">change this color to the fill color within the image</td> </tr> <tr> <td valign="top">OrderedDither</td> <td valign="top">threshold=>{threshold, checks, o2x2, o3x3, o4x4, o8x8, h4x4a, h6x6a, h8x8a, h4x4o, h6x6o, h8x8o, h16x16o, hlines6x4}, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">order dither image</td> </tr> <tr> <td valign="top">Polaroid</td> <td valign="top">caption=><i>string</i>, angle=><i>double</i>, pointsize=><i>double</i>, font=><i>string</i>, stroke=> <i><a href="../www/color.html">color name</a></i>, strokewidth=><i>integer</i>, fill=><i><a href="../www/color.html">color name</a></i>, gravity=>{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}, background=><i><a href="../www/color.html">color name</a></i></td> <td valign="top">simulate a Polaroid picture.</td> </tr> <tr> <td valign="top">Posterize</td> <td valign="top">levels=><i>integer</i>, dither=>{True, False}</td> <td valign="top">reduce the image to a limited number of color level</td> </tr> <tr> <td valign="top">Profile</td> <td valign="top">name=><i>string</i>, profile=><i>blob</i>, rendering-intent=>{Undefined, Saturation, Perceptual, Absolute, Relative}, black-point-compensation=>{True, False}</td> <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> </tr> <tr> <td valign="top">Quantize</td> <td valign="top">colors=><i>integer</i>, colorspace=>{RGB, Gray, Transparent, OHTA, XYZ, YCbCr, YIQ, YPbPr, YUV, CMYK, sRGB, HSL, HSB}, treedepth=> <i>integer</i>, dither=>{True, False}, dither-method=>{Riemersma, Floyd-Steinberg}, measure_error=>{True, False}, global_colormap=>{True, False}, transparent-color=><i>color</i></td> <td valign="top">preferred number of colors in the image</td> </tr> <tr> <td valign="top">RadialBlur</td> <td valign="top">angle=><i>double</i></td> <td valign="top">radial blur the image.</td> </tr> <tr> <td valign="top">Raise</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i>, raise=>{True, False}</td> <td valign="top">lighten or darken image edges to create a 3-D effect</td> </tr> <tr> <td valign="top">Recolor</td> <td valign="top">matrix=><i>array of float values</i></td> <td valign="top">translate, scale, shear, or rotate image colors. Although you can use variable sized matrices, typically you use a 5 x 5 for an RGBA image and a 6x6 for CMYKA. Populate the last row with normalized values to translate.</td> </tr> <tr> <td valign="top">ReduceNoise</td> <td valign="top">radius=><i>double</i></td> <td valign="top">reduce noise in the image with a noise peak elimination filter</td> </tr> <tr> <td valign="top">Resample</td> <td valign="top">density=><i>geometry</i>, x=><i>double</i>, y=><i>double</i>, filter=>{Point, Box, Triangle, Hermite, Hanning, Hamming, Blackman, Gaussian, Quadratic, Cubic, Catrom, Mitchell, Lanczos, Bessel, Sinc}, support=><i>double</i></td> <td valign="top">resample image to desired resolution. Specify <kbd>blur</kbd> > 1 for blurry or < 1 for sharp</td> </tr> <tr> <td valign="top">Resize</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, filter=>{Point, Box, Triangle, Hermite, Hanning, Hamming, Blackman, Gaussian, Quadratic, Cubic, Catrom, Mitchell, Lanczos, Bessel, Sinc}, support=><i>double</i>, blur=><i>double</i></td> <td valign="top">scale image to desired size. Specify <kbd>blur</kbd> > 1 for blurry or < 1 for sharp</td> </tr> <tr> <td valign="top">Roll</td> <td valign="top">geometry=><i>geometry</i>, x=><i>integer</i>, y=><i>integer</i></td> <td valign="top">roll an image vertically or horizontally</td> </tr> <tr> <td valign="top">Rotate</td> <td valign="top">degrees=><i>double</i>, background=><i><a href="../www/color.html">color name</a></i></td> <td valign="top">rotate an image</td> </tr> <tr> <td valign="top">Sample</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i></td> <td valign="top">scale image with pixel sampling.</td> </tr> <tr> <td valign="top">Scale</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i></td> <td valign="top">scale image to desired size</td> </tr> <tr> <td valign="top">Segment</td> <td valign="top">colorspace=>{RGB, Gray, Transparent, OHTA, XYZ, YCbCr, YCC, YIQ, YPbPr, YUV, CMYK}, verbose={True, False}, cluster-threshold=><i>double</i>, smoothing-threshold=<i>double</i></td> <td valign="top">segment an image by analyzing the histograms of the color components and identifying units that are homogeneous</td> </tr> <tr> <td valign="top">Separate</td> <td valign="top">channel=>{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}</td> <td valign="top">separate a channel from the image into a grayscale image</td> </tr> <tr> <td valign="top">Shade</td> <td valign="top">geometry=><i>geometry</i>, azimuth=><i>double</i>, elevation=><i>double</i>, gray=>{true, false}</td> <td valign="top">shade the image using a distant light source</td> </tr> <tr> <td valign="top">SetPixel</td> <td valign="top">geometry=><i>geometry</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}, color=><i>array of float values</i>, x=><i>integer</i>, y=><i>integer</i>, color=><i>array of float values</i></td> <td valign="top">set a single pixel. By default normalized pixel values are expected.</td> </tr> <tr> <td valign="top">Shadow</td> <td valign="top">geometry=><i>geometry</i>, opacity=><i>double</i>, sigma=><i>double</i>, x=><i>integer</i>, y=><i>integer</i></td> <td valign="top">simulate an image shadow</td> </tr> <tr> <td valign="top">Sharpen</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">sharpen the image with a Gaussian operator of the given radius and standard deviation (sigma).</td> </tr> <tr> <td valign="top">Shave</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i></td> <td valign="top">shave pixels from the image edges</td> </tr> <tr> <td valign="top">Shear</td> <td valign="top">geometry=><i>geometry</i>, x=><i>double</i>, y=><i>double</i> fill=><i><a href="../www/color.html">color name</a></i></td> <td valign="top">shear the image along the X or Y axis by a positive or negative shear angle</td> </tr> <tr> <td valign="top">SigmoidalContrast</td> <td valign="top">geometry=><i>string</i>, 'contrast'=><i>double</i>, 'mid-point'=><i>double</i> channel=>{Red, RGB, CMYK, Cyan, Green, Magenta, Blue, Yellow, Opacity, Black, or All}, sharpen=>{True, False}</td> <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> </tr> <tr> <td valign="top">Signature</td> <td valign="top"><br /></td> <td valign="top">generate an SHA-256 message digest for the image pixel stream</td> </tr> <tr> <td valign="top">Sketch</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, angle=><i>double</i></td> <td valign="top">sketch the image with a Gaussian operator of the given radius and standard deviation (sigma) at the given angle</td> </tr> <tr> <td valign="top">Solarize</td> <td valign="top">geometry=><i>string</i>,threshold=><i>double</i></td> <td valign="top">negate all pixels above the threshold level</td> </tr> <tr> <td valign="top">SparseColor</td> <td valign="top">points=><i>array of float values</i>, method=>{Barycentric, Bilinear, Shepards, Voronoi}, virtual-pixel=>{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}</td> <td valign="top">interpolate the image colors around the supplied points</td> </tr> <tr> <td valign="top">Splice</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i>, fuzz=><i>double</i>, background=><i><a href="../www/color.html">color name</a></i>, gravity=>{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td> <td valign="top">splice an image</td> </tr> <tr> <td valign="top">Spread</td> <td valign="top">radius=><i>double</i></td> <td valign="top">displace image pixels by a random amount</td> </tr> <tr> <td valign="top">Stegano</td> <td valign="top">image=><i>image-handle</i>, offset=><i>integer</i></td> <td valign="top">hide a digital watermark within the image</td> </tr> <tr> <td valign="top">Stereo</td> <td valign="top">image=><i>image-handle</i>, x=><i>integer</i>, y=><i>integer</i></td> <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> </tr> <tr> <td valign="top">Strip</td> <td valign="top"><br /></td> <td valign="top">strip an image of all profiles and comments.</td> </tr> <tr> <td valign="top">Swirl</td> <td valign="top">degrees=><i>double</i>, interpolate=>{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}</td> <td valign="top">swirl image pixels about the center</td> </tr> <tr> <td valign="top">Texture</td> <td valign="top">texture=><i>image-handle</i></td> <td valign="top">name of texture to tile onto the image background</td> </tr> <tr> <td valign="top">Thumbnail</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i></td> <td valign="top">changes the size of an image to the given dimensions and removes any associated profiles.</td> </tr> <tr> <td valign="top">Threshold</td> <td valign="top">threshold=><i>string</i>, channel=>{All, Default, Alpha, Black, Blue, CMYK, Cyan, Gray, Green, Index, Magenta, Opacity, Red, RGB, Yellow}</td> <td valign="top">threshold the image</td> </tr> <tr> <td valign="top">Tint</td> <td valign="top">fill=><i><a href="../www/color.html">color name</a></i>, opacity=><i>string</i></td> <td valign="top">tint the image with the fill color.</td> </tr> <tr> <td valign="top">Transparent</td> <td valign="top">color=><i><a href="../www/color.html">color name</a></i>, invert=>{True, False}</td> <td valign="top">make this color transparent within the image</td> </tr> <tr> <td valign="top">Transpose</td> <td valign="top"><br /></td> <td valign="top">flip image in the vertical direction and rotate 90 degrees</td> </tr> <tr> <td valign="top">Transverse</td> <td valign="top"><br /></td> <td valign="top">flop image in the horizontal direction and rotate 270 degrees</td> </tr> <tr> <td valign="top">Trim</td> <td valign="top"><br /></td> <td valign="top">remove edges that are the background color from the image</td> </tr> <tr> <td valign="top">UnsharpMask</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, amount=><i>double</i>, threshold=><i>double</i></td> <td valign="top">sharpen the image with the unsharp mask algorithm.</td> </tr> <tr> <td valign="top">Vignette</td> <td valign="top">geometry=><i>geometry</i>, radius=><i>double</i>, sigma=><i>double</i>, x=><i>integer</i>, y=><i>integer</i>, background=><i><a href="../www/color.html">color name</a></i></td> <td valign="top">offset the edges of the image in vignette style</td> </tr> <tr> <td valign="top">Wave</td> <td valign="top">geometry=><i>geometry</i>, amplitude=><i>double</i>, wavelength=><i>double</i>, interpolate=>{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}</td> <td valign="top">alter an image along a sine wave</td> </tr> <tr> <td valign="top">WhiteThreshold</td> <td valign="top">threshold=><i>string</i></td> <td valign="top">force all pixels above the threshold intensity into white</td> </tr> </tbody> </table> <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=>'106x80'</kbd> is equivalent to <kbd>width=>106, height=>80</kbd> ).</p> <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> <pre class="code"> $image->Draw(fill=>'red', primitive=>'rectangle', points=>'20,20 100,100 40,40 200,200 60,60 300,300'); </pre> <p>Is equivalent to</p> <pre class="code"> $image->Draw(fill=>'red', primitive=>'@draw.txt'); </pre> <p>Where <kbd>draw.txt</kbd> is a file on disk that contains this:</p> <pre class="text"> rectangle 20, 20 100, 100 rectangle 40, 40 200, 200 rectangle 60, 60 300, 300 </pre> <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> <pre class="text"> %b file size %c comment %d directory %e filename extension %f filename %g page geometry %h height %i input filename %k number of unique colors %l label %m magick %n number of scenes %o output filename %p page number %q quantum depth %r image class and colorspace %s scene number %t top of filename %u unique temporary filename %w width %x x resolution %y y resolution %z image depth %C image compression type %D image dispose method %H page height %Q image compression quality %T image delay %W page width %X page x offset %Y page y offset %@ bounding box %# signature %% a percent sign \n newline \r carriage return </pre> <p>For example,</p> <pre class="text"> text=>"%m:%f %wx%h" </pre> <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> <p>You can optionally add <i>Image</i> to any method name. For example, TrimImage() is an alias for method Trim().</p> <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> <div style="margin: auto;"> <h2><a name="set-attribute"></a>Set an Image Attribute</h2> </div> <p>Use method Set() to set an image attribute. For example,</p> <pre class="code"> $image->Set(dither=>'True'); $image->[$x]->Set(delay=>3); </pre> <p>Where this example uses 'True' and this document says '{True, False}', you can use the case-insensitive strings 'True' and 'False', or you can use the integers 1 and 0.</p> <p>When you call Get() on a Boolean attribute, Image::Magick returns 1 or 0, not a string.</p> <p>And here is a list of all the image attributes you can set:</p> <table class="doc"> <caption>Image Attributes</caption> <tbody> <tr> <th>Attribute</th> <th style="width: 40%">Values</th> <th style="width: 40%">Description</th> </tr> <tr> <td valign="top">adjoin</td> <td valign="top">{True, False}</td> <td valign="top">join images into a single multi-image file</td> </tr> <tr> <td valign="top">alpha</td> <td valign="top">{On, Off, Opaque, Transparent, Copy, Extract, Set}</td> <td valign="top">control of and special operations involving the alpha/matte channel</td> </tr> <tr> <td valign="top">antialias</td> <td valign="top">{True, False}</td> <td valign="top">remove pixel aliasing</td> </tr> <tr> <td valign="top">area-limit</td> <td valign="top"><i>integer</i></td> <td valign="top">set pixel area resource limit in megabytes.</td> </tr> <tr> <td valign="top">attenuate</td> <td valign="top"><i>double</i></td> <td valign="top">lessen (or intensify) when adding noise to an image.</td> </tr> <tr> <td valign="top">authenticate</td> <td valign="top"><i>string</i></td> <td valign="top">decrypt image with this password.</td> </tr> <tr> <td valign="top">background</td> <td valign="top"><i><a href="../www/color.html">color name</a></i></td> <td valign="top">image background color</td> </tr> <tr> <td valign="top">blue-primary</td> <td valign="top"><i>x-value</i>, <i>y-value</i></td> <td valign="top">chromaticity blue primary point (e.g. 0.15, 0.06)</td> </tr> <tr> <td valign="top">bordercolor</td> <td valign="top"><i><a href="../www/color.html">color name</a></i></td> <td valign="top">set the image border color</td> </tr> <tr> <td valign="top">clip-mask</td> <td valign="top"><i>image</i></td> <td valign="top">associate a clip mask with the image.</td> </tr> <tr> <td valign="top">colormap[<i>i</i>]</td> <td valign="top"><i><a href="../www/color.html">color name</a></i></td> <td valign="top">color name (e.g. red) or hex value (e.g. #ccc) at position <i>i</i></td> </tr> <tr> <td valign="top">comment</td> <td valign="top"><i>string</i></td> <td valign="top">set the image comment</td> </tr> <tr> <td valign="top">compression</td> <td valign="top">{None, BZip, Fax, Group4, JPEG, JPEG2000, LosslessJPEG, LZW, RLE, Zip}</td> <td valign="top">type of image compression</td> </tr> <tr> <td valign="top">debug</td> <td valign="top">{All, Annotate, Blob, Cache, Coder, Configure, Deprecate, Draw, Exception, Locale, None, Resource, Transform, X11}</td> <td valign="top">display copious debugging information</td> </tr> <tr> <td valign="top">delay</td> <td valign="top"><i>integer</i></td> <td valign="top">this many 1/100ths of a second must expire before displaying the next image in a sequence</td> </tr> <tr> <td valign="top">density</td> <td valign="top"><i>geometry</i></td> <td valign="top">vertical and horizontal resolution in pixels of the image</td> </tr> <tr> <td valign="top">depth</td> <td valign="top"><i>integer</i></td> <td valign="top">image depth</td> </tr> <tr> <td valign="top">disk-limit</td> <td valign="top"><i>integer</i></td> <td valign="top">set disk resource limit in megabytes</td> </tr> <tr> <td valign="top">dispose</td> <td valign="top"><i>{Undefined, None, Background, Previous}</i></td> <td valign="top">layer disposal method</td> </tr> <tr> <td valign="top">dither</td> <td valign="top">{True, False}</td> <td valign="top">apply error diffusion to the image</td> </tr> <tr> <td valign="top">display</td> <td valign="top"><i>string</i></td> <td valign="top">specifies the X server to contact</td> </tr> <tr> <td valign="top">extract</td> <td valign="top"><i>geometry</i></td> <td valign="top">extract area from image</td> </tr> <tr> <td valign="top">file</td> <td valign="top"><i>filehandle</i></td> <td valign="top">set the image filehandle</td> </tr> <tr> <td valign="top">filename</td> <td valign="top"><i>string</i></td> <td valign="top">set the image filename</td> </tr> <tr> <td valign="top">fill</td> <td valign="top"><i>color</i></td> <td valign="top">The fill color paints any areas inside the outline of drawn shape.</td> </tr> <tr> <td valign="top">font</td> <td valign="top"><i>string</i></td> <td valign="top">use this font when annotating the image with text</td> </tr> <tr> <td valign="top">fuzz</td> <td valign="top"><i>integer</i></td> <td valign="top">colors within this distance are considered equal</td> </tr> <tr> <td valign="top">gamma</td> <td valign="top"><i>double</i></td> <td valign="top">gamma level of the image</td> </tr> <tr> <td valign="top">Gravity</td> <td valign="top">{Forget, NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td> <td valign="top">type of image gravity</td> </tr> <tr> <td valign="top">green-primary</td> <td valign="top"><i>x-value</i>, <i>y-value</i></td> <td valign="top">chromaticity green primary point (e.g. 0.3, 0.6)</td> </tr> <tr> <td valign="top">index[<i>x</i>, <i>y</i>]</td> <td valign="top"><i>string</i></td> <td valign="top">colormap index at position (<i>x</i>, <i>y</i>)</td> </tr> <tr> <td valign="top">interlace</td> <td valign="top">{None, Line, Plane, Partition, JPEG, GIF, PNG}</td> <td valign="top">the type of interlacing scheme</td> </tr> <tr> <td valign="top">iterations</td> <td valign="top"><i>integer</i></td> <td valign="top">add Netscape loop extension to your GIF animation</td> </tr> <tr> <td valign="top">label</td> <td valign="top"><i>string</i></td> <td valign="top">set the image label</td> </tr> <tr> <td valign="top">loop</td> <td valign="top"><i>integer</i></td> <td valign="top">add Netscape loop extension to your GIF animation</td> </tr> <tr> <td valign="top">magick</td> <td valign="top"><i>string</i></td> <td valign="top">set the image format</td> </tr> <tr> <td valign="top">map-limit</td> <td valign="top"><i>integer</i></td> <td valign="top">set map resource limit in megabytes</td> </tr> <tr> <td valign="top">mask</td> <td valign="top"><i>image</i></td> <td valign="top">associate a mask with the image.</td> </tr> <tr> <td valign="top">matte</td> <td valign="top">{True, False}</td> <td valign="top">enable the image matte channel</td> </tr> <tr> <td valign="top">mattecolor</td> <td valign="top"><i><a href="../www/color.html">color name</a></i></td> <td valign="top">set the image matte color</td> </tr> <tr> <td valign="top">memory-limit</td> <td valign="top"><i>integer</i></td> <td valign="top">set memory resource limit in megabytes</td> </tr> <tr> <td valign="top">monochrome</td> <td valign="top">{True, False}</td> <td valign="top">transform the image to black and white</td> </tr> <tr> <td valign="top">option</td> <td valign="top"><i>string</i></td> <td valign="top">associate an option with an image format (e.g. option=>'ps:imagemask'</td> </tr> <tr> <td valign="top">orientation</td> <td valign="top">{top-left, top-right, bottom-right, bottom-left, left-top, right-top, right-bottom, left-bottom}</td> <td valign="top">image orientation</td> </tr> <tr> <td valign="top">page</td> <td valign="top">{ Letter, Tabloid, Ledger, Legal, Statement, Executive, A3, A4, A5, B4, B5, Folio, Quarto, 10x14} or <i>geometry</i></td> <td valign="top">preferred size and location of an image canvas</td> </tr> <tr> <td valign="top">pixel[<i>x</i>, <i>y</i>]</td> <td valign="top"><i>string</i></td> <td valign="top">hex value (e.g. #ccc) at position (<i>x</i>, <i>y</i>)</td> </tr> <tr> <td valign="top">pointsize</td> <td valign="top"><i>integer</i></td> <td valign="top">pointsize of the Postscript or TrueType font</td> </tr> <tr> <td valign="top">quality</td> <td valign="top"><i>integer</i></td> <td valign="top">JPEG/MIFF/PNG compression level</td> </tr> <tr> <td valign="top">red-primary</td> <td valign="top"><i>x-value</i>, <i>y-value</i></td> <td valign="top">chromaticity red primary point (e.g. 0.64, 0.33)</td> </tr> <tr> <td valign="top">sampling-factor</td> <td valign="top"><i>geometry</i></td> <td valign="top">horizontal and vertical sampling factor</td> </tr> <tr> <td valign="top">scene</td> <td valign="top"><i>integer</i></td> <td valign="top">image scene number</td> </tr> <tr> <td valign="top">server</td> <td valign="top"><i>string</i></td> <td valign="top">specifies the X server to contact</td> </tr> <tr> <td valign="top">size</td> <td valign="top"><i>string</i></td> <td valign="top">width and height of a raw image</td> </tr> <tr> <td valign="top">stroke</td> <td valign="top"><i>color</i></td> <td valign="top">The stroke color paints along the outline of a shape.</td> </tr> <tr> <td valign="top">texture</td> <td valign="top"><i>string</i></td> <td valign="top">name of texture to tile onto the image background</td> </tr> <tr> <td valign="top">tile-offset</td> <td valign="top"><i>geometry</i></td> <td valign="top">image tile offset</td> </tr> <tr> <td valign="top">type</td> <td valign="top">{Bilevel, Grayscale, GrayscaleMatte, Palette, PaletteMatte, TrueColor, TrueColorMatte, ColorSeparation, ColorSeparationMatte, Optimize }</td> <td valign="top">image type</td> </tr> <tr> <td valign="top">units</td> <td valign="top">{ Undefined, PixelsPerInch, PixelsPerCentimeter}</td> <td valign="top">units of image resolution</td> </tr> <tr> <td valign="top">verbose</td> <td valign="top">{True, False}</td> <td valign="top">print detailed information about the image</td> </tr> <tr> <td valign="top">virtual-pixel</td> <td valign="top">{Background Black Constant Dither Edge Gray Mirror Random Tile Transparent White}</td> <td valign="top">the virtual pixel method</td> </tr> <tr> <td valign="top">white-point</td> <td valign="top"><i>x-value</i>, <i>y-value</i></td> <td valign="top">chromaticity white point (e.g. 0.3127, 0.329)</td> </tr> </tbody> </table> <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=>'106x80'</kbd> is equivalent to <kbd>width=>106, height=>80</kbd>).</p> <p>SetAttribute() is an alias for method Set().</p> <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> <div style="margin: auto;"> <h2><a name="get-attribute"></a>Get an Image Attribute</h2> </div> <p>Use method Get() to get an image attribute. For example,</p> <pre class="code"> ($a, $b, $c) = $image->Get('colorspace', 'magick', 'adjoin'); $width = $image->[3]->Get('columns'); </pre> <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> <table class="doc"> <caption>Image Attributes</caption> <tbody> <tr> <th>Attribute</th> <th>Values</th> <th style="width: 60%">Description</th> </tr> <tr> <td valign="top">area</td> <td valign="top"><i>integer</i></td> <td valign="top">current area resource consumed</td> </tr> <tr> <td valign="top">base-columns</td> <td valign="top"><i>integer</i></td> <td valign="top">base image width (before transformations)</td> </tr> <tr> <td valign="top">base-filename</td> <td valign="top"><i>string</i></td> <td valign="top">base image filename (before transformations)</td> </tr> <tr> <td valign="top">base-rows</td> <td valign="top"><i>integer</i></td> <td valign="top">base image height (before transformations)</td> </tr> <tr> <td valign="top">class</td> <td valign="top">{Direct, Pseudo}</td> <td valign="top">image class</td> </tr> <tr> <td valign="top">colors</td> <td valign="top"><i>integer</i></td> <td valign="top">number of unique colors in the image</td> </tr> <tr> <td valign="top">columns</td> <td valign="top"><i>integer</i></td> <td valign="top">image width</td> </tr> <tr> <td valign="top">copyright</td> <td valign="top"><i>string</i></td> <td valign="top">get PerlMagick's copyright</td> </tr> <tr> <td valign="top">directory</td> <td valign="top"><i>string</i></td> <td valign="top">tile names from within an image montage</td> </tr> <tr> <td valign="top">elapsed-time</td> <td valign="top"><i>double</i></td> <td valign="top">elapsed time in seconds since the image was created</td> </tr> <tr> <td valign="top">error</td> <td valign="top"><i>double</i></td> <td valign="top">the mean error per pixel computed with methods Compare() or Quantize()</td> </tr> <tr> <td valign="top">bounding-box</td> <td valign="top"><i>string</i></td> <td valign="top">image bounding box</td> </tr> <tr> <td valign="top">disk</td> <td valign="top"><i>integer</i></td> <td valign="top">current disk resource consumed</td> </tr> <tr> <td valign="top">filesize</td> <td valign="top"><i>integer</i></td> <td valign="top">number of bytes of the image on disk</td> </tr> <tr> <td valign="top">format</td> <td valign="top"><i>string</i></td> <td valign="top">get the descriptive image format</td> </tr> <tr> <td valign="top">geometry</td> <td valign="top"><i>string</i></td> <td valign="top">image geometry</td> </tr> <tr> <td valign="top">height</td> <td valign="top"><i>integer</i></td> <td valign="top">the number of rows or height of an image</td> </tr> <tr> <td valign="top">id</td> <td valign="top"><i>integer</i></td> <td valign="top">ImageMagick registry id</td> </tr> <tr> <td valign="top">mean-error</td> <td valign="top"><i>double</i></td> <td valign="top">the normalized mean error per pixel computed with methods Compare() or Quantize()</td> </tr> <tr> <td valign="top">map</td> <td valign="top"><i>integer</i></td> <td valign="top">current memory-mapped resource consumed</td> </tr> <tr> <td valign="top">matte</td> <td valign="top">{True, False}</td> <td valign="top">whether or not the image has a matte channel</td> </tr> <tr> <td valign="top">maximum-error</td> <td valign="top"><i>double</i></td> <td valign="top">the normalized max error per pixel computed with methods Compare() or Quantize()</td> </tr> <tr> <td valign="top">memory</td> <td valign="top"><i>integer</i></td> <td valign="top">current memory resource consumed</td> </tr> <tr> <td valign="top">mime</td> <td valign="top"><i>string</i></td> <td valign="top">MIME of the image format</td> </tr> <tr> <td valign="top">montage</td> <td valign="top"><i>geometry</i></td> <td valign="top">tile size and offset within an image montage</td> </tr> <tr> <td valign="top">page.x</td> <td valign="top"><i>integer</i></td> <td valign="top">x offset of image virtual canvas</td> </tr> <tr> <td valign="top">page.y</td> <td valign="top"><i>integer</i></td> <td valign="top">y offset of image virtual canvas</td> </tr> <tr> <td valign="top">rows</td> <td valign="top"><i>integer</i></td> <td valign="top">the number of rows or height of an image</td> </tr> <tr> <td valign="top">signature</td> <td valign="top"><i>string</i></td> <td valign="top">SHA-256 message digest associated with the image pixel stream</td> </tr> <tr> <td valign="top">taint</td> <td valign="top">{True, False}</td> <td valign="top">True if the image has been modified</td> </tr> <tr> <td valign="top">total-ink-density</td> <td valign="top"><i>double</i></td> <td valign="top">returns the total ink density for a CMYK image</td> </tr> <tr> <td valign="top">transparent-color</td> <td valign="top"><i><a href="../www/color.html">color name</a></i></td> <td valign="top">set the image transparent color</td> </tr> <tr> <td valign="top">user-time</td> <td valign="top"><i>double</i></td> <td valign="top">user time in seconds since the image was created</td> </tr> <tr> <td valign="top">version</td> <td valign="top"><i>string</i></td> <td valign="top">get PerlMagick's version</td> </tr> <tr> <td valign="top">width</td> <td valign="top"><i>integer</i></td> <td valign="top">the number of columns or width of an image</td> </tr> <tr> <td valign="top">x-resolution</td> <td valign="top"><i>integer</i></td> <td valign="top">x resolution of the image</td> </tr> <tr> <td valign="top">y-resolution</td> <td valign="top"><i>integer</i></td> <td valign="top">y resolution of the image</td> </tr> </tbody> </table> <p>GetAttribute() is an alias for method Get().</p> <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> <div style="margin: auto;"> <h2><a name="montage"></a>Create an Image Montage</h2> </div> <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> <pre class="code"> $image->Montage(geometry=>'160x160', tile=>'2x2', texture=>'granite:'); </pre> <p>And here is a list of Montage() parameters you can set:</p> <table class="doc"> <caption>Montage Parameters</caption> <tbody> <tr> <th>Parameter</th> <th style="width: 40%">Values</th> <th style="width: 40%">Description</th> </tr> <tr> <td valign="top">background</td> <td valign="top"><i><a href="../www/color.html">color name</a></i></td> <td valign="top">background color name</td> </tr> <tr> <td valign="top">border</td> <td valign="top"><i>integer</i></td> <td valign="top">image border width</td> </tr> <tr> <td valign="top">filename</td> <td valign="top"><i>string</i></td> <td valign="top">name of montage image</td> </tr> <tr> <td valign="top">fill</td> <td valign="top"><a href="../www/color.html">color name</a></td> <td valign="top">fill color for annotations</td> </tr> <tr> <td valign="top">font</td> <td valign="top"><i>string</i></td> <td valign="top">X11 font name</td> </tr> <tr> <td valign="top">frame</td> <td valign="top"><i>geometry</i></td> <td valign="top">surround the image with an ornamental border</td> </tr> <tr> <td valign="top">geometry</td> <td valign="top"><i>geometry</i></td> <td valign="top">preferred tile and border size of each tile of the composite image (e.g. 120x120+4+3>)</td> </tr> <tr> <td valign="top">gravity</td> <td valign="top">{NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast}</td> <td valign="top">direction image gravitates to within a tile</td> </tr> <tr> <td valign="top">label</td> <td valign="top"><i>string</i></td> <td valign="top">assign a label to an image</td> </tr> <tr> <td valign="top">mode</td> <td valign="top">{Frame, Unframe, Concatenate}</td> <td valign="top">thumbnail framing options</td> </tr> <tr> <td valign="top">pointsize</td> <td valign="top"><i>integer</i></td> <td valign="top">pointsize of the Postscript or TrueType font</td> </tr> <tr> <td valign="top">shadow</td> <td valign="top">{True, False}</td> <td valign="top">add a shadow beneath a tile to simulate depth</td> </tr> <tr> <td valign="top">stroke</td> <td valign="top"><a href="../www/color.html">color name</a></td> <td valign="top">stroke color for annotations</td> </tr> <tr> <td valign="top">texture</td> <td valign="top"><i>string</i></td> <td valign="top">name of texture to tile onto the image background</td> </tr> <tr> <td valign="top">tile</td> <td valign="top"><i>geometry</i></td> <td valign="top">the number of tiles per row and page (e.g. 6x4)</td> </tr> <tr> <td valign="top">title</td> <td valign="top">string</td> <td valign="top">assign a title to the image montage</td> </tr> <tr> <td valign="top">transparent</td> <td valign="top"><i>string</i></td> <td valign="top">make this color transparent within the image</td> </tr> </tbody> </table> <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=>'106x80'</kbd> is equivalent to <kbd>width=>106, height=>80</kbd>).</p> <p>MontageImage() is an alias for method Montage().</p> <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> <div style="margin: auto;"> <h2><a name="blobs"></a>Working with Blobs</h2> </div> <p>A blob contains data that directly represent a particular image format in memory instead of on disk. PerlMagick supports blobs 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> <table class="doc"> <caption>Blob Methods</caption> <tbody> <tr> <th>Method</th> <th>Parameters</th> <th>Return Value</th> <th>Description</th> </tr> <tr> <td valign="top">ImageToBlob</td> <td valign="top">any image <a href="#set-attribute">attribute</a></td> <td valign="top">an array of image data in the respective image format</td> <td valign="top">convert an image or image sequence to an array of blobs</td> </tr> <tr> <td valign="top">BlobToImage</td> <td valign="top">one or more blobs</td> <td valign="top">the number of blobs converted to an image</td> <td valign="top">convert one or more blobs to an image</td> </tr> </tbody> </table> <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> <pre class="code"> @blobs = $image->ImageToBlob(); open(DISPLAY,"| display -") || die; binmode DISPLAY; print DISPLAY $blobs[0]; close DISPLAY; </pre> <p>Method BlobToImage() returns an image or image sequence converted from the supplied blob:</p> <pre class="code"> @blob=$db->GetImage(); $image=Image::Magick->new(magick=>'jpg'); $image->BlobToImage(@blob); </pre> <div style="margin: auto;"> <h2><a name="direct-access"></a>Direct-access to Image Pixels</h2> </div> <p>Use these methods to obtain direct access to the image pixels:</p> <table class="doc"> <caption>Direct-access to Image Pixels</caption> <tbody> <tr> <th>Method</th> <th>Parameters</th> <th style="width: 50%">Description</th> </tr> <tr> <td valign="top">AcquireImagePixels</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i></td> <td valign="top">return image pixels as a const C pointer</td> </tr> <tr> <td valign="top">GetImagePixels</td> <td valign="top">geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>, x=><i>integer</i>, y=><i>integer</i></td> <td valign="top">return image pixels as a C pointer</td> </tr> <tr> <td valign="top">GetIndexes</td> <td valign="top">return image indexes as a C pointer</td> </tr> <tr> <td valign="top">SyncImagePixels</td> <td valign="top"></td> <td valign="top">sync image pixels to pixel cache</td> </tr> </tbody> </table> <div style="margin: auto;"> <h2><a name="miscellaneous"></a>Miscellaneous Methods</h2> </div> <p>The Append() method append a set of images. For example,</p> <pre class="code"> $p = $image->Append(stack=>{true,false}); </pre> <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> <p>The Average() method averages a set of images. For example,</p> <pre class="code"> $p = $image->Average(); </pre> <p>averages all the images associated with object <kbd>$image</kbd>.</p> <p>The Clone() method copies a set of images. For example,</p> <pre class="code"> $q = $p->Clone(); </pre> <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> <p>The Flatten() method flattens a set of images and returns it. For example,</p> <pre class="code"> $p = $images->Flatten(background=>'none'); $p->Write('flatten.png'); </pre> <p>The sequence of images is replaced by a single image created by composing each image after the first over the first image.</p> <p>The Fx() method applies a mathematical expression to a set of images and returns the results. For example,</p> <pre class="code"> $p = $image->Fx(expression=>'(g+b)/2.0',channel=>'red'); $p->Write('fx.miff'); </pre> <p>replaces the red channel with the average of the green and blue channels.</p> <p>See <a href="../www/fx.html">FX, The Special Effects Image Operator</a> for a detailed discussion of this method.</p> <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> <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> <pre class="code"> $p = $image->Morph(frames=><i>integer</i>); </pre> <p>where <i>frames</i> is the number of in-between images to generate. The default is 1.</p> <p>Mosaic() creates an mosaic from an image sequence.</p> <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> <pre class="code"> $image->Crop('340x256+0+0'); $image->Mogrify('crop', '340x256+0+0'); </pre> <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> <pre class="code"> $image->MogrifyRegion('100x100+40+50', 'modulate', brightness=>50); </pre> <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> <pre class="code"> ($width, $height, $size, $format) = $image->Ping('logo.png'); ($width, $height, $size, $format) = $image->Ping(file=>\*IMAGE); ($width, $height, $size, $format) = $image->Ping(blob=>$blob); </pre> <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> <pre class="code"> $preview = $image->Preview('Gamma'); $preview->Display(); </pre> <p>To have full control over text positioning you need font metric information. Use</p> <pre class="code"> ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $image->QueryFontMetrics(<i>parameters</i>); </pre> <p>Where <i>parameters</i> is any parameter of the <a href="#manipulate">Annotate</a> method. The return values are:</p> <ul> <li>character width</li> <li>character height</li> <li>ascender</li> <li>descender</li> <li>text width</li> <li>text height</li> <li>maximum horizontal advance</li> <li>bounds: x1</li> <li>bounds: y1</li> <li>bounds: x2</li> <li>bounds: y2</li> <li>origin: x</li> <li>origin: y</li> </ul> <p>Use QueryMultilineFontMetrics() to get the maximum text width and height for multiple lines of text.</p> <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> <pre class="code"> @colors = $image->QueryColor(); ($red, $green, $blue, $opacity) = $image->QueryColor('cyan'); ($red, $green, $blue, $opacity) = $image->QueryColor('#716bae'); </pre> <p>QueryColorname() accepts a color value and returns its respective name or hex value;</p> <pre class="code"> $name = $image->QueryColorname('rgba(80,60,0,0)'); </pre> <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> <pre class="code"> @fonts = $image->QueryFont(); $weight = ($image->QueryFont('Helvetica'))[5]; </pre> <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> <pre class="code"> @formats = $image->QueryFormat(); ($adjoin, $blob_support, $raw, $decoder, $encoder, $description, $module) = $image->QueryFormat('gif'); </pre> <p>Call MagickToMime() with the image format name to get its MIME type such as <kbd>images/tiff</kbd> from <kbd>tif</kbd>.</p> <pre class="code"> $mime = $image->MagickToMime('tif'); </pre> <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> <pre class="code"> $image->RemoteCommand('image.jpg'); </pre> <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> <pre class="code"> @statistics = $image->Statistics(); </pre> <p>Finally, the Transform() method accepts a fully-qualified geometry specification for cropping or resizing one or more images. For example,</p> <pre class="code"> $p = $image->Transform(crop=>'100x100+0+0', gravity=>'Center'); </pre> <p>You can optionally add <i>Image</i> to any method name above. For example, PingImage() is an alias for method Ping().</p> <div style="margin: auto;"> <h2><a name="exceptions"></a>Handling Exceptions</h2> </div> <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> <p>Methods which return a number (e.g. Read(), Write()):</p> <pre class="code"> $x = $image->Read(...); warn "$x" if "$x"; # print the error message $x =~ /(\d+)/; print $1; # print the error number print 0+$x; # print the number of images read </pre> <p>Methods which operate on an image (e.g. Resize(), Crop()):</p> <pre class="code"> $x = $image->Crop(...); warn "$x" if "$x"; # print the error message $x =~ /(\d+)/; print $1; # print the error number </pre> <p>Methods which return images (Average(), Montage(), Clone()) should be checked for errors this way:</p> <pre class="code"> $x = $image->Montage(...); warn "$x" if !ref($x); # print the error message $x =~ /(\d+)/; print $1; # print the error number </pre> <p>Here is an example error message:</p> <pre class="code"> Error 400: Memory allocation failed </pre> <p>Below is a list of error and warning codes:</p> <table class="doc"> <caption>Error and Warning Codes</caption> <tbody> <tr> <th>Code</th> <th>Mnemonic</th> <th style="width: 60%">Description</th> </tr> <tr> <td valign="top">0</td> <td valign="top">Success</td> <td valign="top">method completed without an error or warning</td> </tr> <tr> <td valign="top">300</td> <td valign="top">ResourceLimitWarning</td> <td valign="top">a program resource is exhausted (e.g. not enough memory)</td> </tr> <tr> <td valign="top">305</td> <td valign="top">TypeWarning</td> <td valign="top">A font is unavailable; a substitution may have occurred</td> </tr> <tr> <td valign="top">310</td> <td valign="top">OptionWarning</td> <td valign="top">a command-line option was malformed</td> </tr> <tr> <td valign="top">315</td> <td valign="top">DelegateWarning</td> <td valign="top">an ImageMagick <i>delegate</i> returned a warning</td> </tr> <tr> <td valign="top">320</td> <td valign="top">MissingDelegateWarning</td> <td valign="top">the image type can not be read or written because the appropriate <i>Delegate</i> is missing</td> </tr> <tr> <td valign="top">325</td> <td valign="top">CorruptImageWarning</td> <td valign="top">the image file may be corrupt</td> </tr> <tr> <td valign="top">330</td> <td valign="top">FileOpenWarning</td> <td valign="top">the image file could not be opened</td> </tr> <tr> <td valign="top">335</td> <td valign="top">BlobWarning</td> <td valign="top">a binary large object could not be allocated</td> </tr> <tr> <td valign="top">340</td> <td valign="top">StreamWarning</td> <td valign="top">there was a problem reading or writing from a stream</td> </tr> <tr> <td valign="top">345</td> <td valign="top">CacheWarning</td> <td valign="top">pixels could not be saved to the pixel cache</td> </tr> <tr> <td valign="top">350</td> <td valign="top">CoderWarning</td> <td valign="top">there was a problem with an image coder</td> </tr> <tr> <td valign="top">355</td> <td valign="top">ModuleWarning</td> <td valign="top">there was a problem with an image module</td> </tr> <tr> <td valign="top">360</td> <td valign="top">DrawWarning</td> <td valign="top">a drawing operation failed</td> </tr> <tr> <td valign="top">365</td> <td valign="top">ImageWarning</td> <td valign="top">the operation could not complete due to an incompatible image</td> </tr> <tr> <td valign="top">380</td> <td valign="top">XServerWarning</td> <td valign="top">an X resource is unavailable</td> </tr> <tr> <td valign="top">385</td> <td valign="top">MonitorWarning</td> <td valign="top">there was a problem with prgress monitor</td> </tr> <tr> <td valign="top">390</td> <td valign="top">ConfigureWarning</td> <td valign="top">there was a problem getting a configuration file</td> </tr> <tr> <td valign="top">395</td> <td valign="top">RegistryWarning</td> <td valign="top">there was a problem getting or setting the registry</td> </tr> <tr> <td valign="top">400</td> <td valign="top">ResourceLimitError</td> <td valign="top">a program resource is exhausted (e.g. not enough memory)</td> </tr> <tr> <td valign="top">405</td> <td valign="top">TypeError</td> <td valign="top">A font is unavailable; a substitution may have occurred</td> </tr> <tr> <td valign="top">410</td> <td valign="top">OptionError</td> <td valign="top">a command-line option was malformed</td> </tr> <tr> <td valign="top">415</td> <td valign="top">DelegateError</td> <td valign="top">an ImageMagick <i>delegate</i> returned a warning</td> </tr> <tr> <td valign="top">420</td> <td valign="top">MissingDelegateError</td> <td valign="top">the image type can not be read or written because the appropriate <i>Delegate</i> is missing</td> </tr> <tr> <td valign="top">425</td> <td valign="top">CorruptImageError</td> <td valign="top">the image file may be corrupt</td> </tr> <tr> <td valign="top">430</td> <td valign="top">FileOpenError</td> <td valign="top">the image file could not be opened</td> </tr> <tr> <td valign="top">435</td> <td valign="top">BlobError</td> <td valign="top">a binary large object could not be allocated</td> </tr> <tr> <td valign="top">440</td> <td valign="top">StreamError</td> <td valign="top">there was a problem reading or writing from a stream</td> </tr> <tr> <td valign="top">445</td> <td valign="top">CacheError</td> <td valign="top">pixels could not be saved to the pixel cache</td> </tr> <tr> <td valign="top">450</td> <td valign="top">CoderError</td> <td valign="top">there was a problem with an image coder</td> </tr> <tr> <td valign="top">455</td> <td valign="top">ModuleError</td> <td valign="top">there was a problem with an image module</td> </tr> <tr> <td valign="top">460</td> <td valign="top">DrawError</td> <td valign="top">a drawing operation failed</td> </tr> <tr> <td valign="top">465</td> <td valign="top">ImageError</td> <td valign="top">the operation could not complete due to an incompatible image</td> </tr> <tr> <td valign="top">480</td> <td valign="top">XServerError</td> <td valign="top">an X resource is unavailable</td> </tr> <tr> <td valign="top">485</td> <td valign="top">MonitorError</td> <td valign="top">there was a progress monitor error</td> </tr> <tr> <td valign="top">490</td> <td valign="top">ConfigureError</td> <td valign="top">there was a problem getting a configuration file</td> </tr> <tr> <td valign="top">495</td> <td valign="top">RegistryError</td> <td valign="top">there was a problem getting or setting the registry</td> </tr> </tbody> </table> <p>The following illustrates how you can use a numeric status code:</p> <pre class="code"> $x = $image->Read('rose.png'); $x =~ /(\d+)/; die "unable to continue" if ($1 == ResourceLimitError); </pre> <div style="margin: auto;"> <h2><a name="constants"></a>Constants</h2> </div> <p>PerlMagick includes these constants:</p> <pre class="text"> BlobError BlobWarning CacheError CacheWarning CoderError CoderWarning ConfigureError ConfigureWarning CorruptImageError CorruptImageWarning DelegateError DelegateWarning DrawError DrawWarning ErrorException FatalErrorException FileOpenError FileOpenWarning ImageError ImageWarning MissingDelegateError MissingDelegateWarning ModuleError ModuleWarning Opaque OptionError OptionWarning QuantumDepth QuantumRange RegistryError RegistryWarning ResourceLimitError ResourceLimitWarning StreamError StreamWarning Success Transparent TypeError TypeWarning WarningException XServerError XServerWarning </pre> <p>You can access them like this:</p> <pre class="text"> Image::Magick->QuantumDepth </pre> </div> <div id="linkbar"> <!-- <span id="linkbar-west"> </span> --> <span id="linkbar-center"> <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> • <a href="../www/mailing-list.html">Mailing Lists</a> • <a href="http://cafe.imagemagick.org">Cafe</a> • <a href="http://studio.webbyland.com/ImageMagick/MagickStudio/scripts/MagickStudio.cgi">Studio</a> </span> <span id="linkbar-east"> </span> </div> <div class="footer"> <span id="footer-west">© 1999-2009 ImageMagick Studio LLC</span> <span id="footer-east"> <a href="http://www.imagemagick.org/script/contact.php">Contact the Wizards</a></span> </div> <div style="clear: both; margin: 0; width: 100%; "></div> </body> </html>