<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="description" content="ImageMagick, version 5.1.1, is a    robust collection of tools and libraries to read, write, and manipulate    an image in any of the more popular image formats including GIF, JPEG,    PNG, PDF, and Photo CD.  With ImageMagick you can create GIFs dynamically    making it suitable for Web applications.  You can also resize, rotate,    sharpen, color reduce, or add special effects to an image and save your    completed work in the same or  differing image format.">
   <meta name="keywords" content="ImageMagick, Image Magick, Image Magic,    PerlMagick, Perl Magick, Perl Magic, CineMagick, PixelMagick, Pixel Magic,    WebMagick, Web Magic, visualization, image processing, software     development, simulation, image, software, AniMagick, Animagic,    Magick++">
   <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
   <title>ImageMagick - Image Processing and Display Package</title>
<link rev="made" href="mailto:magick@wizards.dupont.com">
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#1F00FF" vlink="#9900DD" alink="#FF0000">

<center><img SRC="../images/magick_small.png" height=125 width=121></center>

<p><br>
<p><a NAME="contents"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Contents</font></font></font></b></td>
</tr>
</table>

<ul>
<li>
<a href="#intr">Introduction</a></li>

<li>
<a href="#inst">Installation</a></li>

<li>
<a href="#over">Overview</a></li>

<li>
<a href="#exam">Example Script</a></li>

<li>
<a href="#read">Read or Write an Image</a></li>

<li>
<a href="#mani">Manipulate an Image</a></li>

<li>
<a href="#seta">Set an Image Attribute</a></li>

<li>
<a href="#geta">Get an Image Attribute</a></li>

<li>
<a href="#mont">Create an Image Montage</a></li>

<li>
<a href="#misc">Miscellaneous Methods</a></li>

<li>
<a href="#erro">Handling Errors</a></li>

<li>
<a href="#blobs">Working with Blobs</a></li>

<li>
<a href="#copy">Copyright</a></li>
</ul>

<dl><a NAME="intr"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Introduction</font></font></font></b></td>
</tr>
</table>

<dd>
<a href="ftp://ftp.wizards.dupont.com/pub/ImageMagick/perl">PerlMagick</a>,
version 5.11, is an objected-oriented <a href="http://www.perl.com/perl/">Perl</a>
interface to <a href="../ImageMagick.html">ImageMagick</a>. 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 <b>ImageMagick</b> 5.1.1 or above and Perl version 5.002 or greater
installed on your system for either of these utilities to work. Perl version
5.005_02 or greater is required for <b>PerlMagick</b> to work on an NT
system.</dd>

<p><br>There are a number of useful scripts available to show you the value
of
<b>PerlMagick</b>. You can do Web based image manipulation and conversion
with
<a href="ftp://ftp.wizards.dupont.com/pub/ImageMagick/perl">MogrifyMagick</a>,
or use
<a href="ftp://ftp.wizards.dupont.com/pub/ImageMagick/perl">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="ftp://ftp.wizards.dupont.com/pub/ImageMagick/perl">WebMagick
Image Navigator</a>.
<p>You can try <b>PerlMagick</b> from your Web browser at the <a href="http://magick.imagemagick.org/cristy/MogrifyMagick/scripts/MogrifyMagick.cgi/">ImageMagick
Studio</a>. Or, you can see
<a href="../images/examples.jpg">examples</a>
of select <b>PerlMagick</b> functions.
<p>An object-oriented Python interface to <b>ImageMagick</b> is also available,
see <a href="http://starship.skyport.net/crew/zack/pymagick/">PythonMagick</a>.</dl>
<i><a href="#contents">Back to Contents</a></i>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="inst"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Installation</font></font></font></b></td>
</tr>
</table>

<dd>
<b>UNIX</b></dd>

<p><br>&nbsp;ImageMagick must already be installed on your system. Next,
get the
<a href="ftp://ftp.wizards.dupont.com/pub/ImageMagick/perl">PerlMagick</a>
distribution and unpack it as shown below:
<pre>&nbsp;&nbsp;&nbsp; gunzip -c PerlMagick-5.11.tar.gz | tar -xvf -
&nbsp;&nbsp;&nbsp; cd PerlMagick</pre>
Next, edit <tt>Makefile.PL</tt> and change LIBS and INC to include the
appropriate path information to the required <tt>libMagick</tt> library.
You will also need paths to JPEG, PNG, TIFF, etc. delegates if they were
included with your installed version of <b>ImageMagick</b>. Build and install
it like this:
<pre>&nbsp;&nbsp;&nbsp; perl Makefile.PL
&nbsp;&nbsp;&nbsp; make
&nbsp;&nbsp;&nbsp; make install</pre>
For Unix, you typically need to be <tt>root</tt> to install the software.
There are ways around this. Consult the Perl manual pages for more information.
<p><b>Windows NT / Windows 95</b>
<p>&nbsp;ImageMagick must already be installed on your system. Also, the
ImageMagick source distribution for
<a href="ftp://ftp.wizards.dupont.com/pub/ImageMagick/nt">Windows
NT</a> is required. You must also have the <tt>nmake</tt> from the Visual
C++ or J++ development environment. Copy <tt>\bin\IMagick.dll</tt> and
<tt>\bin\X11.dll</tt>
to a directory in your dynamic load path such as
<tt>c:\perl\site\5.00502</tt>.
Next, type
<pre>&nbsp;&nbsp;&nbsp; cd PerlMagick
&nbsp;&nbsp;&nbsp; copy Makefile.nt Makefile.PL
&nbsp;&nbsp;&nbsp; perl Makefile.PL
&nbsp;&nbsp;&nbsp; nmake
&nbsp;&nbsp;&nbsp; nmake install</pre>
<b>Running the Regression Tests</b>
<p>&nbsp;To verify a correct installation, type
<pre>&nbsp;&nbsp;&nbsp; make test</pre>
Use <tt>nmake test</tt> under Windows. There are ao few demonstration scripts
available to exercise many of the functions <b>PerlMagick</b> can perform.
Type
<pre>&nbsp;&nbsp;&nbsp; cd demo
&nbsp;&nbsp;&nbsp; make</pre>
You are now ready to utilize the <b>PerlMagick</b> methods from within
your Perl scripts.</dl>
<i><a href="#contents">Back to Contents</a></i>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="over"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Overview</font></font></font></b></td>
</tr>
</table>

<dd>
Any script that wants to use <b>PerlMagick</b> methods must first define
the methods within its namespace and instantiate an image object. Do this
with:</dd>

<pre>&nbsp;&nbsp;&nbsp; use Image::Magick;

&nbsp;&nbsp;&nbsp; $image=Image::Magick->new;</pre>
The <i>new</i> method takes the same parameters as <a href="#seta">SetAttribute</a>.
For example,
<pre>&nbsp;&nbsp;&nbsp; $image=Image::Magick->new(size=>'384x256');</pre>
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
<b>PerlMagick</b>
are defined in <a href="#read">Read or Write an Image</a>. See <a href="#seta">Set
an Image Attribute</a> for methods that affect the way an image is read
or written. Refer to
<a href="#mani">Manipulate an Image</a> for a list
of methods to transform an image. <a href="#geta">Get an Image Attribute</a>
describes how to retrieve an attribute for an image. Refer to
<a href="#mont">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>Once you are finished with a <b>PerlMagick</b> 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
<b>PerlMagick</b>
object, the memory is returned for use by other Perl methods. The recommended
way to destroy an object is with <tt>undef</tt>:
<pre>&nbsp;&nbsp;&nbsp; undef $image;</pre>
To delete all the images but retain the <tt>Image::Magick</tt> object use
<pre>&nbsp;&nbsp;&nbsp; undef @$image;</pre>
and finally, to delete a single image from a multi-image sequence, use
<pre>&nbsp;&nbsp;&nbsp; undef $image->[x];</pre>
The next section illustrates how to use various <b>PerlMagick</b> methods
to manipulate an image sequence.
<p>Some of the <b>PerlMagick</b> methods require external programs such
as
<i>Ghostscript</i>. This may require an explicit path in your PATH environment
variable to work properly. For example,
<pre>&nbsp;&nbsp;&nbsp; $ENV{PATH}='/bin:/usr/bin:/usr/local/bin';</pre>
</dl>
<i><a href="#contents">Back to Contents</a></i>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="exam"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Example
Script</font></font></font></b></td>
</tr>
</table>

<dd>
Here is an example script to get you started:</dd>

<pre>&nbsp;&nbsp;&nbsp; #!/usr/local/bin/perl
&nbsp;&nbsp;&nbsp; use Image::Magick;

&nbsp;&nbsp;&nbsp; my($image, $x);

&nbsp;&nbsp;&nbsp; $image = Image::Magick->new;
&nbsp;&nbsp;&nbsp; $x = $image->Read('girl.png', 'logo.png', 'rose.png');
&nbsp;&nbsp;&nbsp; warn "$x" if "$x";

&nbsp;&nbsp;&nbsp; $x = $image->Crop(geometry=>'100x100"+1"00"+1"00');
&nbsp;&nbsp;&nbsp; warn "$x" if "$x";

&nbsp;&nbsp;&nbsp; $x = $image->Write('x.png');
&nbsp;&nbsp;&nbsp; warn "$x" if "$x";</pre>
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 is done:
<pre>&nbsp;&nbsp;&nbsp; #!/usr/local/bin/perl
&nbsp;&nbsp;&nbsp; use Image::Magick;

&nbsp;&nbsp;&nbsp; my($image, $p, $q);

&nbsp;&nbsp;&nbsp; $image = new Image::Magick;
&nbsp;&nbsp;&nbsp; $image->Read('x1.png');
&nbsp;&nbsp;&nbsp; $image->Read('j*.jpg');
&nbsp;&nbsp;&nbsp; $image->Read('k.miff[1, 5, 3]');
&nbsp;&nbsp;&nbsp; $image->Contrast;
&nbsp;&nbsp;&nbsp; for ($x = 0; $image->[x]; $x++)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $image->[x]->Frame('100x200') if $image->[x]->Get('magick') eq 'GIF';
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; undef $image->[x] if $image->[x]->Get('columns') &lt; 100;
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; $p = $image->[1];
&nbsp;&nbsp;&nbsp; $p->Draw(pen=>'red', primitive=>'rectangle', points=>20,20 100,100');
&nbsp;&nbsp;&nbsp; $q = $p->Montage();
&nbsp;&nbsp;&nbsp; undef $image;
&nbsp;&nbsp;&nbsp; $q->Write('x.miff');</pre>
Suppose you want to start out with a 100 by 100 pixel white canvas with
a red pixel in the center. Try
<pre>&nbsp;&nbsp;&nbsp; $image = Image::Magick->new;
&nbsp;&nbsp;&nbsp; $image->Set(size=>'100x100');
&nbsp;&nbsp;&nbsp; $image->ReadImage('xc:white');
&nbsp;&nbsp;&nbsp; $image->Set('pixel[49,49]'=>'red');</pre>
Or suppose you want to convert your color image to grayscale:
<pre>&nbsp;&nbsp;&nbsp; $image->Quantize(colorspace=>'gray');</pre>
Here we annotate an image with a Taipai TrueType font:
<pre>&nbsp;&nbsp;&nbsp; $text = "\\0x17ef\\0x30ec\\0x25ec\\0x23ef\\0x17ec";
&nbsp;&nbsp;&nbsp; $image->Annotate(font=>'@kai.ttf', pointsize=>40, pen=>'green', text=>$text);</pre>
Other clever things you can do with <b>PerlMagick</b> objects include
<pre>&nbsp;&nbsp;&nbsp; $i = $#$p"+1";&nbsp;&nbsp;&nbsp;&nbsp; # return the number of images associated with object p
&nbsp;&nbsp;&nbsp; push(@$q, @$p);&nbsp; # push the images from object p onto object q
&nbsp;&nbsp;&nbsp; undef @$p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # delete the images but not the object p</pre>
</dl>
<i><a href="#contents">Back to Contents</a></i>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="read"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Read
or Write an Image</font></font></font></b></td>
</tr>
</table>

<dd>
Use the methods listed below to either read, write, or display an image
or image sequence.</dd>

<table BORDER >
<caption>Read or Write Methods</caption>

<tr>
<th>Method</th>

<th>Parameters</th>

<th>Return Value</th>

<th>Description</th>
</tr>

<tr>
<td>Read</td>

<td>one or more filenames</td>

<td>the number of images read&nbsp;</td>

<td>read an image or image sequence</td>
</tr>

<tr>
<td>Write</td>

<td>filename</td>

<td>the number of images written&nbsp;</td>

<td>write an image or image sequence</td>
</tr>

<tr>
<td>Display</td>

<td>server name</td>

<td>the number of images displayed&nbsp;</td>

<td>display the image or image sequence to an X server</td>
</tr>

<tr>
<td>Animate</td>

<td>server name</td>

<td>the number of images animated&nbsp;</td>

<td>animate image sequence to an X server</td>
</tr>
</table>

<p>For convenience, methods <tt>Write</tt>, <tt>Display</tt>, and
<tt>Animate</tt>
can take any parameter that <a href="#seta">SetAttribute</a> knows about.
For example,
<pre>&nbsp;&nbsp;&nbsp; $image->Write(filename=>'image.png', compress=>'None');</pre>
Use <tt>-</tt> as the filename to method <tt>Read</tt> to read from standard
in or to method <tt>Write</tt> to write to standard out:
<pre>&nbsp;&nbsp;&nbsp; binmode STDOUT;
&nbsp;&nbsp;&nbsp; $image->Write(.png:-');</pre>
To read an image in the GIF format from a PERL filehandle, use:
<pre>&nbsp;&nbsp;&nbsp; $image = Image::Magick->new(magick=>'GIF');
&nbsp;&nbsp;&nbsp; open(DATA, 'image.png');
&nbsp;&nbsp;&nbsp; $image->Read(file=>DATA);
&nbsp;&nbsp;&nbsp; close(DATA);</pre>
To write an image in the PNG format to a PERL filehandle, use:
<pre>&nbsp;&nbsp;&nbsp; $filename = "image.png";
&nbsp;&nbsp;&nbsp; open(DATA, ">$filename");
&nbsp;&nbsp;&nbsp; $image->Write(file=>DATA, filename=>$filename);
&nbsp;&nbsp;&nbsp; close(DATA);</pre>
You can optionally add <tt>Image</tt> to any method name. For example,
<tt>ReadImage</tt>
is an alias for method <tt>Read</tt>.</dl>
<i><a href="#contents">Back to Contents</a></i>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="mani"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Manipulate
an Image</font></font></font></b></td>
</tr>
</table>

<dd>
Once you create an image with, for example, method <tt>ReadImage</tt> you
may want to operate on it. Below is a list of all the image manipulations
methods available to you with <b>PerlMagick</b>. There are <a href="../images/examples.jpg">examples</a>
of select
<b>PerlMagick</b> methods. Here is an example call to an image
manipulation method:</dd>

<pre>&nbsp;&nbsp;&nbsp; $image->Crop(geometry=>'100x100"+1"0+20');
&nbsp;&nbsp;&nbsp; $image->[x]->Frame("100x200");</pre>
And here is a list of other image manipulation methods you can call:
<table BORDER >
<caption>Image Manipulation Methods</caption>

<tr>
<th>Method</th>

<th>Parameters</th>

<th>Description</th>
</tr>

<tr>
<td>AddNoise</td>

<td>noise=>{Uniform, Gaussian, Multiplicative, Impulse, Laplacian, Poisson}</td>

<td>add noise to an image</td>
</tr>

<tr>
<td>Annotate</td>

<td>text=><i>string</i>, font=><i>string</i>, pointsize=><i>integer</i>,
density=><i>geometry</i>, box=><i>colorname</i>, pen=><i>colorname</i>,
geometry=><i>geometry</i>, server=>{<i>string</i>, @<i>filename</i>}, gravity=>{NorthWest,
North, NorthEast, West, Center, East, SouthWest, South, SouthEast}, x=><i>integer</i>,
y=><i>integer</i>, degrees=><i>double</i></td>

<td>annotate an image with text.</td>
</tr>

<tr>
<td>Blur</td>

<td>factor=><i>percentage</i></td>

<td>blurs an image</td>
</tr>

<tr>
<td>Border</td>

<td>geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>,
color=<i>colorname</i></td>

<td>surround the image with a border of color</td>
</tr>

<tr>
<td>Charcoal</td>

<td>factor=><i>percentage</i></td>

<td>simulate a charcoal drawing</td>
</tr>

<tr>
<td>Chop</td>

<td>geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>,
x=><i>integer</i>, y=><i>integer</i></td>

<td>chop an image</td>
</tr>

<tr>
<td>Clone</td>

<td></td>

<td>make a copy an image</td>
</tr>

<tr>
<td>Coalesce</td>

<td></td>

<td>merge a sequence of images</td>
</tr>

<tr>
<td>ColorFloodfill</td>

<td>geometry=><i>geometry</i>, x=><i>integer</i>, y=><i>integer</i>, pen=<i>colorname</i>,
bordercolor=<i>colorname</i></td>

<td>changes the color value of any pixel that matches the color of the
target pixel and is a neighbor. If you specify a border color, the color
value is changed for any neighbor pixel that is not that color.</td>
</tr>

<tr>
<td>Colorize</td>

<td>color=><i>colorname</i>, pen=><i>colorname</i></td>

<td>colorize the image with the pen color</td>
</tr>

<tr>
<td>Comment</td>

<td>string</td>

<td>add a comment to your image</td>
</tr>

<tr>
<td>Composite</td>

<td>compose=>{Over, In, Out, Atop, Xor, Plus, Minus, Add, Subtract, Difference,
Bumpmap, Replace, ReplaceRed, ReplaceGreen, ReplaceBlue, ReplaceMatte,
Blend, Displace}, image=><i>image-handle, geometry=>geometry, x=>integer,
y=>integer, gravity=>{NorthWest, North, NorthEast, West, Center, East,
SouthWest, South, SouthEast}</i></td>

<td>composite one image onto another</td>
</tr>

<tr>
<td>Condense</td>

<td></td>

<td>compress image to take up the least amount of memory</td>
</tr>

<tr>
<td>Contrast</td>

<td>sharpen=>{True, False}</td>

<td>enhance or reduce the image contrast</td>
</tr>

<tr>
<td>Crop</td>

<td>geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>,
x=><i>integer</i>, y=><i>integer</i></td>

<td>crop an image</td>
</tr>

<tr>
<td>CycleColormap</td>

<td>amount=><i>integer</i></td>

<td>displace image colormap by amount</td>
</tr>

<tr>
<td>Deconstruct</td>

<td></td>

<td>break down an image sequence into constituent parts</td>
</tr>

<tr>
<td>Despeckle</td>

<td></td>

<td>reduce the speckles within an image</td>
</tr>

<tr>
<td>Draw</td>

<td>primitive={Point, Line, Rectangle, FillRectangle, Circle, FillCircle,
Ellipse, FillEllipse, Polygon, FillPolygon, Color, Matte, Text, Image,
@<i>filename</i>}, points=><i>string</i>, method=<i>{Point, Replace, Floodfill,
FillToBorder, Reset}</i>, pen=><i>colorname</i>, bordercolor=><i>colorname</i>,
linewidth=><i>integer</i>, server=><i>string</i>,&nbsp;</td>

<td>annotate an image with one or more graphic primitives</td>
</tr>

<tr>
<td>Edge</td>

<td>factor=><i>percentage</i></td>

<td>detect edges within an image</td>
</tr>

<tr>
<td>Emboss</td>

<td></td>

<td>emboss the image</td>
</tr>

<tr>
<td>Enhance</td>

<td></td>

<td>apply a digital filter to enhance a noisy image</td>
</tr>

<tr>
<td>Equalize</td>

<td></td>

<td>perform histogram equalization to the image</td>
</tr>

<tr>
<td>Flip</td>

<td></td>

<td>create a <i>mirror image</i> by reflecting the image scanlines in the
vertical direction</td>
</tr>

<tr>
<td>Flop</td>

<td></td>

<td>create a <i>mirror image</i> by reflecting the image scanlines in the
horizontal direction</td>
</tr>

<tr>
<td>Frame</td>

<td>geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i>,
inner=><i>integer</i>, outer=><i>integer</i>, color=><i>colorname</i></td>

<td>surround the image with an ornamental border</td>
</tr>

<tr>
<td>Gamma</td>

<td>gamma=><i>double</i>, red=><i>double</i>, green=><i>double</i>, blue=><i>double</i></td>

<td>gamma correct the image</td>
</tr>

<tr>
<td>Implode</td>

<td>factor=><i>percentage</i></td>

<td>implode image pixels about the center</td>
</tr>

<tr>
<td>Label</td>

<td>string</td>

<td>assign a label to an image</td>
</tr>

<tr>
<td>Layer</td>

<td>layer={Red, Green, Blue, Matte}</td>

<td>extract a layer from the image</td>
</tr>

<tr>
<td>Magnify</td>

<td></td>

<td>double the size of an image</td>
</tr>

<tr>
<td>Map</td>

<td>image=><i>image-handle</i>, dither={True, False}</td>

<td>choose a particular set of colors from this image</td>
</tr>

<tr>
<td>MatteFloodfill</td>

<td>geometry=><i>geometry</i>, x=><i>integer</i>, y=><i>integer</i>, matte=<i>integer</i>,
bordercolor=<i>colorname</i></td>

<td>changes the matte value of any pixel that matches the color of the
target pixel and is a neighbor. If you specify a border color, the matte
value is changed for any neighbor pixel that is not that color.</td>
</tr>

<tr>
<td>MedianFilter</td>

<td>radius=><i>integer</i></td>

<td>replace each pixel with the median intensity pixel of a neighborhood.</td>
</tr>

<tr>
<td>Minify</td>

<td></td>

<td>half the size of an image</td>
</tr>

<tr>
<td>Modulate</td>

<td>brightness=><i>double</i>, saturation=><i>double</i>, hue=><i>double</i></td>

<td>vary the brightness, saturation, and hue of an image</td>
</tr>

<tr>
<td>Negate</td>

<td>gray=>{True, False}</td>

<td>replace every pixel with its complementary color (white becomes black,
yellow becomes blue, etc.)</td>
</tr>

<tr>
<td>Normalize</td>

<td></td>

<td>transform image to span the full range of color values</td>
</tr>

<tr>
<td>OilPaint</td>

<td>radius=><i>integer</i></td>

<td>simulate an oil painting</td>
</tr>

<tr>
<td>Opaque</td>

<td>color=><i>colorname</i>, pen=><i>colorname</i></td>

<td>change this color to the pen color within the image</td>
</tr>

<tr>
<td>Quantize</td>

<td>colors=><i>integer</i>, colorspace=>{RGB, Gray, Transparent, OHTA,
XYZ, YCbCr, YIQ, YPbPr, YUV, CMYK}, treedepth=> <i>integer</i>, dither=>{True,
False}, measure_error=>{True, False}, global_colormap=>{True, False}</td>

<td>preferred number of colors in the image</td>
</tr>

<tr>
<td>Raise</td>

<td>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>lighten or darken image edges to create a 3-D effect</td>
</tr>

<tr>
<td>ReduceNoise</td>

<td></td>

<td>add or reduce the noise in an image</td>
</tr>

<tr>
<td>Roll</td>

<td>geometry=><i>geometry</i>, x=><i>integer</i>, y=><i>integer</i></td>

<td>roll an image vertically or horizontally</td>
</tr>

<tr>
<td>Rotate</td>

<td>degrees=><i>double</i>, crop=>{True, False}, sharpen=>{True, False}</td>

<td>roll an image vertically or horizontally</td>
</tr>

<tr>
<td>Sample</td>

<td>geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i></td>

<td>scale image with pixel sampling</td>
</tr>

<tr>
<td>Scale</td>

<td>geometry=><i>geometry</i>, width=><i>integer</i>, height=><i>integer</i></td>

<td>scale image to desired size</td>
</tr>

<tr>
<td>Segment</td>

<td>colorspace=>{RGB, Gray, Transparent, OHTA, XYZ, YCbCr, YCC, YIQ, YPbPr,
YUV, CMYK}, verbose={True, False}, cluster=><i>double</i>, smooth=<i>double</i></td>

<td>segment an image by analyzing the histograms of the color components
and identifying units that are homogeneous</td>
</tr>

<tr>
<td>Shade</td>

<td>geometry=><i>geometry</i>, azimuth=><i>double</i>, elevation=><i>double</i>,
color=>{true, false}&nbsp;</td>

<td>shade the image using a distant light source</td>
</tr>

<tr>
<td>Sharpen</td>

<td>factor=><i>percentage</i></td>

<td>sharpen an image</td>
</tr>

<tr>
<td>Shear</td>

<td>geometry=><i>geometry</i>, x=><i>double</i>, y=><i>double</i>, crop=>{true,
false}</td>

<td>shear the image along the X or Y axis by a positive or negative shear
angle</td>
</tr>

<tr>
<td>Signature</td>

<td></td>

<td>generate an MD5 signature for the image</td>
</tr>

<tr>
<td>Solarize</td>

<td>factor=><i>percentage</i></td>

<td>negate all pixels above the threshold level</td>
</tr>

<tr>
<td>Spread</td>

<td>amount=><i>integer</i></td>

<td>displace image pixels by a random amount</td>
</tr>

<tr>
<td>Stereo</td>

<td>image=><i>image-handle</i></td>

<td>combines 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>Stegano</td>

<td>image=><i>image-handle</i>, offset=<i>integer</i></td>

<td>hide a digital watermark within the image</td>
</tr>

<tr>
<td>Swirl</td>

<td>degrees=><i>double</i></td>

<td>swirl image pixels about the center</td>
</tr>

<tr>
<td>Texture</td>

<td>texture=><i>image-handle</i></td>

<td>name of texture to tile onto the image background</td>
</tr>

<tr>
<td>Threshold</td>

<td>threshold=><i>integer</i></td>

<td>threshold the image</td>
</tr>

<tr>
<td>Transform</td>

<td>crop=><i>geometry</i>, geometry=><i>geometry</i>, filter=>{Point, Box,
Triangle, Hermite, Hanning, Hamming, Blackman, Gaussian, Quadratic, Cubic,
Catrom, Mitchell, Lanczos, Bessel, Sinc}</td>

<td>crop or resize an image with a fully-qualified geometry specification</td>
</tr>

<tr>
<td>Transparent</td>

<td>color=><i>colorname</i></td>

<td>make this color transparent within the image</td>
</tr>

<tr>
<td>Trim</td>

<td></td>

<td>remove edges that are the background color from the image</td>
</tr>

<tr>
<td>Wave</td>

<td>geometry=><i>geometry</i>, amplitude=><i>double</i>, wavelength=><i>double</i></td>

<td>alter an image along a sine wave</td>
</tr>

<tr>
<td>Zoom</td>

<td>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}, blur=><i>double</i></td>

<td>scale image to desired size. Specify <tt>blur</tt> > 1 for blurry or
&lt; 1 for sharp</td>
</tr>
</table>

<p>Note, that the <tt>geometry</tt> parameter is a short cut for the
<tt>width</tt>
and <tt>height</tt> parameters (e.g. <tt>geometry=>'106x80'</tt> is equivalent
to <tt>width=>106, height=>80</tt>).
<p>You can specify <tt>@filename</tt> in both <tt>Annotate</tt> and <tt>Draw</tt>.
This reads the text or graphic primitive instructions from a file on disk.
For example,
<pre>&nbsp;&nbsp; $image->Draw(pen=>'red', primitive=>'rectangle',&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; points=>'20,20 100,100&nbsp; 40,40 200,200&nbsp; 60,60 300,300');</pre>
Is eqivalent to
<pre>&nbsp;&nbsp; $image->Draw(pen=>'red', primitive=>'@draw.txt');</pre>
Where <tt>draw.txt</tt> is a file on disk that contains this:
<pre>&nbsp; rectangle 20, 20 100, 100
&nbsp; rectangle 40, 40 200, 200
&nbsp; rectangle 60, 60 300, 300</pre>
The <i>text</i> parameter for methods, <tt>Annotate</tt>, <tt>Comment</tt>,
<tt>Draw</tt>,
and <tt>Label</tt> can include the image filename, type, width, height,
or other image attribute by embedding these special format characters:
<pre>&nbsp;&nbsp;&nbsp; %b&nbsp;&nbsp; file size
&nbsp;&nbsp;&nbsp; %d&nbsp;&nbsp; directory
&nbsp;&nbsp;&nbsp; %e&nbsp;&nbsp; filename extension
&nbsp;&nbsp;&nbsp; %f&nbsp;&nbsp; filename
&nbsp;&nbsp;&nbsp; %h&nbsp;&nbsp; height
&nbsp;&nbsp;&nbsp; %m&nbsp;&nbsp; magick
&nbsp;&nbsp;&nbsp; %p&nbsp;&nbsp; page number
&nbsp;&nbsp;&nbsp; %s&nbsp;&nbsp; scene number
&nbsp;&nbsp;&nbsp; %t&nbsp;&nbsp; top of filename
&nbsp;&nbsp;&nbsp; %w&nbsp;&nbsp; width
&nbsp;&nbsp;&nbsp; %x&nbsp;&nbsp; x resolution
&nbsp;&nbsp;&nbsp; %y&nbsp;&nbsp; y resolution
&nbsp;&nbsp;&nbsp; \n&nbsp;&nbsp; newline
&nbsp;&nbsp;&nbsp; \r&nbsp;&nbsp; carriage return</pre>
For example,
<pre>&nbsp; text=>"%m:%f %wx%h"</pre>

<dd>
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.</dd>

<p><br>You can optionally add <tt>Image</tt> to any method name. For example,
<tt>TrimImage</tt>
is an alias for method <tt>Trim</tt>.
<p>Most of the attributes listed above have an analog in
<a href="convert.html">convert</a>.
See the documentation for a more detailed description of these attributes.</dl>
<i><a href="#contents">Back to Contents</a></i>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="seta"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Set
an Image Attribute</font></font></font></b></td>
</tr>
</table>

<dd>
Use method <tt>Set</tt> to set an image attribute. For example,</dd>

<pre>&nbsp;&nbsp;&nbsp; $image->Set(dither=>'True');
&nbsp;&nbsp;&nbsp; $image->[$x]->Set(delay=>3);</pre>
And here is a list of all the image attributes you can set:
<table BORDER >
<caption>Image Attributes</caption>

<tr>
<th>Attribute</th>

<th>Values</th>

<th>Description</th>
</tr>

<tr>
<td>adjoin</td>

<td>{True, False}</td>

<td>join images into a single multi-image file</td>
</tr>

<tr>
<td>antialias</td>

<td>{True, False}</td>

<td>remove pixel aliasing</td>
</tr>

<tr>
<td>background</td>

<td><i>string</i></td>

<td>image background color</td>
</tr>

<tr>
<td>blue_primary</td>

<td><i>x-value</i>, <i>y-value</i></td>

<td>chromaticity blue primary point (e.g. 0.15, 0.06)</td>
</tr>

<tr>
<td>bordercolor</td>

<td><i>string</i></td>

<td>set the image border color</td>
</tr>

<tr>
<td>cache_threshold</td>

<td><i>integer</i></td>

<td>Image pixels are stored in memory until 80 megabytes of memory have
been consumed. Subsequent pixel operations are cached on disk. Operations
to memory are significantly faster but if your computer does not have a
sufficient amount of free memory you may want to lower this threshold.</td>
</tr>

<tr>
<td>colormap[<i>i</i>]</td>

<td><i>string</i></td>

<td>color name (e.g. red) or hex value (e.g. #ccc) at position <i>i</i></td>
</tr>

<tr>
<td>colorspace</td>

<td>{RGB, CMYK}</td>

<td>type of colorspace</td>
</tr>

<tr>
<td>compress</td>

<td>None, BZip, Fax, Group4, JPEG, LZW, Runlength, Zip</td>

<td>type of image compression</td>
</tr>

<tr>
<td>delay</td>

<td><i>integer</i></td>

<td>this many 1/100ths of a second\fP must expire before displaying the
next image in a sequence</td>
</tr>

<tr>
<td>density</td>

<td><i>geometry</i></td>

<td>vertical and horizontal resolution in pixels of the image</td>
</tr>

<tr>
<td>dispose</td>

<td><i>{0, 1, 2, 3, 4}</i></td>

<td>GIF disposal method</td>
</tr>

<tr>
<td>dither</td>

<td>{True, False}</td>

<td>apply error diffusion to the image</td>
</tr>

<tr>
<td>display</td>

<td><i>string</i></td>

<td>specifies the X server to contact</td>
</tr>

<tr>
<td>file</td>

<td><i>filehandle</i></td>

<td>set the image filehandle</td>
</tr>

<tr>
<td>filename</td>

<td><i>string</i></td>

<td>set the image filename</td>
</tr>

<tr>
<td>font</td>

<td><i>string</i></td>

<td>use this font when annotating the image with text</td>
</tr>

<tr>
<td>fuzz</td>

<td><i>integer</i></td>

<td>colors within this distance are considered equal</td>
</tr>

<tr>
<td>green_primary</td>

<td><i>x-value</i>, <i>y-value</i></td>

<td>chromaticity green primary point (e.g. 0.3, 0.6)</td>
</tr>

<tr>
<td>interlace</td>

<td>{None, Line, Plane, Partition}</td>

<td>the type of interlacing scheme</td>
</tr>

<tr>
<td>iterations</td>

<td><i>integer</i></td>

<td>add Netscape loop extension to your GIF animation</td>
</tr>

<tr>
<td>loop</td>

<td><i>integer</i></td>

<td>add Netscape loop extension to your GIF animation</td>
</tr>

<tr>
<td>magick</td>

<td><i>string</i></td>

<td>set the image format</td>
</tr>

<tr>
<td>matte</td>

<td>{True, False}</td>

<td>True if the image has transparency</td>
</tr>

<tr>
<td>mattecolor</td>

<td><i>string</i></td>

<td>set the image matte color</td>
</tr>

<tr>
<td>monochrome</td>

<td>{True, False}</td>

<td>transform the image to black and white</td>
</tr>

<tr>
<td>page</td>

<td>{ Letter, Tabloid, Ledger, Legal, Statement, Executive, A3, A4, A5,
B4, B5, Folio, Quarto, 10x14} or <i>geometry</i></td>

<td>preferred size and location of an image canvas</td>
</tr>

<tr>
<td>pen</td>

<td><i>color</i></td>

<td>color name (e.g. red) or hex value (e.g. #ccc) for annotating or changing
opaque color</td>
</tr>

<tr>
<td>pixel[<i>x</i>, <i>y</i>]</td>

<td><i>string</i></td>

<td>color name (e.g. red) or hex value (e.g. #ccc) at position (<i>x</i>,
<i>y</i>)</td>
</tr>

<tr>
<td>pointsize</td>

<td><i>integer</i></td>

<td>pointsize of the Postscript or TrueType font</td>
</tr>

<tr>
<td>preview</td>

<td>{ 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}&nbsp;</td>

<td>type of preview for the Preview image format</td>
</tr>

<tr>
<td>quality</td>

<td><i>integer</i></td>

<td>JPEG/MIFF/PNG compression level</td>
</tr>

<tr>
<td>red_primary</td>

<td><i>x-value</i>, <i>y-value</i></td>

<td>chromaticity red primary point (e.g. 0.64, 0.33)</td>
</tr>

<tr>
<td>rendering_intent</td>

<td>{Undefined, Saturation, Perceptual, Absolute, Relative}</td>

<td>the type of rendering intent</td>
</tr>

<tr>
<td>scene</td>

<td><i>integer</i></td>

<td>image scene number</td>
</tr>

<tr>
<td>subimage</td>

<td><i>integer</i></td>

<td>subimage of an image sequence</td>
</tr>

<tr>
<td>subrange</td>

<td><i>integer</i></td>

<td>number of images relative to the base image</td>
</tr>

<tr>
<td>server</td>

<td><i>string</i></td>

<td>specifies the X server to contact</td>
</tr>

<tr>
<td>size</td>

<td><i>string</i></td>

<td>width and height of a raw image</td>
</tr>

<tr>
<td>tile</td>

<td><i>string</i></td>

<td>tile name</td>
</tr>

<tr>
<td>texture</td>

<td><i>string</i></td>

<td>name of texture to tile onto the image background</td>
</tr>

<tr>
<td>units</td>

<td>{ Undefined, PixelsPerInch, PixelsPerCentimeters}</td>

<td>units of image resolution</td>
</tr>

<tr>
<td>verbose</td>

<td>{True, False}</td>

<td>print detailed information about the image</td>
</tr>

<tr>
<td>view</td>

<td><i>string</i></td>

<td>FlashPix viewing parameters</td>
</tr>

<tr>
<td>white_point</td>

<td><i>x-value</i>, <i>y-value</i></td>

<td>chromaticity white point (e.g. 0.3127, 0.329)</td>
</tr>
</table>

<p>Note, that the <tt>geometry</tt> parameter is a short cut for the
<tt>width</tt>
and <tt>height</tt> parameters (e.g. <tt>geometry=>'106x80'</tt> is equivalent
to <tt>width=>106, height=>80</tt>).
<p><tt>SetAttribute</tt> is an alias for method <tt>Set</tt>.
<p>Most of the attributes listed above have an analog in
<a href="convert.html">convert</a>.
See the documentation for a more detailed description of these attributes.</dl>
<a href="#contents">Back to Contents</a>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="geta"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Get
an Image Attribute</font></font></font></b></td>
</tr>
</table>

<dd>
Use method <tt>Get</tt> to get an image attribute. For example,</dd>

<pre>&nbsp;&nbsp;&nbsp; ($a, $b, $c) = $image->Get('colorspace', 'magick', 'adjoin');
&nbsp;&nbsp;&nbsp; $width = $image->[3]->Get('columns');</pre>
In addition to all the attributes listed in <a href="#seta">Set an Image
Attribute</a>, you can get these additional attributes:
<table BORDER >
<caption>Image Attributes</caption>

<tr>
<th>Attribute</th>

<th>Values</th>

<th>Description</th>
</tr>

<tr>
<td>base_columns</td>

<td><i>integer</i></td>

<td>base image width (before transformations)</td>
</tr>

<tr>
<td>base_filename</td>

<td><i>string</i></td>

<td>base image filename (before transformations)</td>
</tr>

<tr>
<td>base_rows</td>

<td><i>integer</i></td>

<td>base image height (before transformations)</td>
</tr>

<tr>
<td>class</td>

<td>{Direct, Pseudo}</td>

<td>image class</td>
</tr>

<tr>
<td>colors</td>

<td><i>integer</i></td>

<td>number of unique colors in the image</td>
</tr>

<tr>
<td>comment</td>

<td><i>string</i></td>

<td>image comment</td>
</tr>

<tr>
<td>columns</td>

<td><i>integer</i></td>

<td>image width</td>
</tr>

<tr>
<td>depth</td>

<td><i>integer</i></td>

<td>image depth</td>
</tr>

<tr>
<td>directory</td>

<td><i>string</i></td>

<td>tile names from within an image montage</td>
</tr>

<tr>
<td>filesize</td>

<td><i>integer</i></td>

<td>number of bytes of the image on disk</td>
</tr>

<tr>
<td>format</td>

<td><i>string</i></td>

<td>get the descriptive image format</td>
</tr>

<tr>
<td>gamma</td>

<td><i>double</i></td>

<td>gamma level of the image</td>
</tr>

<tr>
<td>geometry</td>

<td><i>string</i></td>

<td>image geometry</td>
</tr>

<tr>
<td>height</td>

<td><i>integer</i></td>

<td>the number of rows or height of an image</td>
</tr>

<tr>
<td>label</td>

<td><i>string</i></td>

<td>image label</td>
</tr>

<tr>
<td>mean</td>

<td><i>double</i></td>

<td>the mean error per pixel computed when an image is color reduced</td>
</tr>

<tr>
<td>montage</td>

<td><i>geometry</i></td>

<td>tile size and offset within an image montage</td>
</tr>

<tr>
<td>normalized_max</td>

<td><i>double</i></td>

<td>the normalized max error per pixel computed when an image is color
reduced</td>
</tr>

<tr>
<td>normalized_mean</td>

<td><i>double</i></td>

<td>the normalized mean error per pixel computed when an image is color
reduced</td>
</tr>

<tr>
<td>rows</td>

<td><i>integer</i></td>

<td>the number of rows or height of an image</td>
</tr>

<tr>
<td>signature</td>

<td><i>string</i></td>

<td>MD5 signature associated with the image</td>
</tr>

<tr>
<td>tainted</td>

<td>{True, False}</td>

<td>True if the image has been modified</td>
</tr>

<tr>
<td>text</td>

<td><i>string</i></td>

<td>any text associated with the image</td>
</tr>

<tr>
<td>type</td>

<td>{Bilevel, Grayscale, Palette, TrueColor, MatteType, ColorSeparation
}</td>

<td>image type</td>
</tr>

<tr>
<td>width</td>

<td><i>integer</i></td>

<td>the number of columns or width of an image</td>
</tr>

<tr>
<td>x-resolution</td>

<td><i>integer</i></td>

<td>x resolution of the image</td>
</tr>

<tr>
<td>y-resolution</td>

<td><i>integer</i></td>

<td>y resolution of the image</td>
</tr>
</table>

<p><tt>GetAttribute</tt> is an alias for method <tt>Get</tt>.
<p>Most of the attributes listed above have an analog in
<a href="convert.html">convert</a>.
See the documentation for a more detailed description of these attributes.</dl>
<a href="#contents">Back to Contents</a>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="mont"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Create
an Image Montage</font></font></font></b></td>
</tr>
</table>

<dd>
Use method <tt>Montage</tt> 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,</dd>

<pre>&nbsp;&nbsp;&nbsp; $image->Montage(geometry=>'160x160', tile=>'2x2', texture=>'granite:');</pre>
And here is a list of <tt>Montage</tt> parameters you can set:
<table BORDER >
<caption>Montage Parameters</caption>

<tr>
<th>Parameter</th>

<th>Values</th>

<th>Description</th>
</tr>

<tr>
<td>background</td>

<td><i>color</i></td>

<td>X11 color name</td>
</tr>

<tr>
<td>borderwidth</td>

<td><i>integer</i></td>

<td>image border width</td>
</tr>

<tr>
<td>compose</td>

<td>{Over, In, Out, Atop, Xor, Plus, Minus, Add, Subtract, Difference,
Bumpmap, Replace, MatteReplace, Mask, Blend, Displace}</td>

<td>composite operator</td>
</tr>

<tr>
<td>filename</td>

<td><i>string</i></td>

<td>name of montage image</td>
</tr>

<tr>
<td>font</td>

<td><i>string</i></td>

<td>X11 font name</td>
</tr>

<tr>
<td>frame</td>

<td><i>geometry</i></td>

<td>surround the image with an ornamental border</td>
</tr>

<tr>
<td>geometry</td>

<td><i>geometry</i></td>

<td>preferred tile and border size of each tile of the composite image</td>
</tr>

<tr>
<td>gravity</td>

<td>{NorthWest, North, NorthEast, West, Center, East, SouthWest, South,
SouthEast}</td>

<td>direction image gravitates to within a tile</td>
</tr>

<tr>
<td>label</td>

<td><i>string</i></td>

<td>assign a label to an image</td>
</tr>

<tr>
<td>mode</td>

<td>{Frame, Unframe, Concatenate}</td>

<td>thumbnail framing options</td>
</tr>

<tr>
<td>pen</td>

<td>string</td>

<td>color for annotation text</td>
</tr>

<tr>
<td>pointsize</td>

<td><i>integer</i></td>

<td>pointsize of the Postscript or TrueType font</td>
</tr>

<tr>
<td>shadow</td>

<td>{True, False}</td>

<td>add a shadow beneath a tile to simulate depth</td>
</tr>

<tr>
<td>texture</td>

<td><i>string</i></td>

<td>name of texture to tile onto the image background</td>
</tr>

<tr>
<td>tile</td>

<td><i>geometry</i></td>

<td>number of tiles per row and column</td>
</tr>

<tr>
<td>title</td>

<td>string</td>

<td>assign a title to the image montage</td>
</tr>

<tr>
<td>transparent</td>

<td><i>string</i></td>

<td>make this color transparent within the image</td>
</tr>
</table>

<p>Note, that the <tt>geometry</tt> parameter is a short cut for the
<tt>width</tt>
and <tt>height</tt> parameters (e.g. <tt>geometry=>'106x80'</tt> is equivalent
to <tt>width=>106, height=>80</tt>).
<p><tt>MontageImage</tt> is an alias for method <tt>Montage</tt>.
<p>Most of the attributes listed above have an analog in
<a href="montage.html">montage</a>.
See the documentation for a more detailed description of these attributes.</dl>
<i><a href="#contents">Back to Contents</a></i>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="misc"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Miscellaneous
Methods</font></font></font></b></td>
</tr>
</table>

<dd>
The <tt>Append</tt> method append a set of images. For example,</dd>

<pre>&nbsp;&nbsp;&nbsp; $x = $image->Append(stack=>{true,false});</pre>
appends all the images associated with object <tt>$image</tt>. All the
input images must have the same width or height. Images of the same width
are stacked top-to-bottom. Images of the same height are stacked left-to-right.
If the stack parameter is false, rectangular images are stacked left-to-right
otherwise top-to-bottom.
<dd>
The <tt>Average</tt> method averages a set of images. For example,</dd>

<pre>&nbsp;&nbsp;&nbsp; $x = $image->Average();</pre>
averages all the images associated with object <tt>$image</tt>.
<dd>
The <tt>Morph</tt> 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:</dd>

<pre>&nbsp;&nbsp;&nbsp; $x = $image->Morph(frames=><i>integer</i>);</pre>
where <i>frames</i> is the number of in-between images to generate. The
default is 1.
<p><tt>Mosaic</tt> create an mosaic from an image sequence.
<p>Method <tt>Mogrify</tt> is a single entry point for the image manipulation
methods (<a href="#mani">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:
<pre>&nbsp;&nbsp;&nbsp; $image->Crop('340x256+0+0');
&nbsp;&nbsp;&nbsp; $image->Mogrify('crop', '340x256+0+0');</pre>
Method <tt>MogrifyRegion</tt> applies a transform to a region of the image.
It is similiar to <tt>Mogrify</tt> but begins with the region geometry.
For example, suppose you want to brighten a 100x100 region of your image
at location (40, 50):
<pre>&nbsp;&nbsp;&nbsp; $image->MogrifyRegion('100x100+40+50', 'modulate', brightness=>50);</pre>

<dd>
The <tt>Clone</tt> method copies a set of images. For example,</dd>

<pre>&nbsp;&nbsp;&nbsp; $p = $image->Clone();</pre>
copies all the images from object <tt>$q</tt> to <tt>$p</tt>. Use this
method for multi-image sequences. <b>PerlMagick</b> transparently creates
a linked list from an image array. If two locations in the array point
to
the same object, the linked list goes into an infinite loop and your script
will run forever until interrupted. Instead of
<pre>&nbsp;&nbsp;&nbsp; push(@$images, $image);
&nbsp;&nbsp;&nbsp; push(@$images, $image);&nbsp; # warning duplicate object</pre>
use cloning to prevent an infinite loop:
<pre>&nbsp;&nbsp;&nbsp; push(@$images, $image);
&nbsp;&nbsp;&nbsp; $clone=$image->Clone();
&nbsp;&nbsp;&nbsp; push(@$images, $clone);&nbsp; # same image but different object</pre>
<tt>Ping</tt> accepts one or more image file names and returns their respective
width, height, size in bytes, and format (e.g. GIF, JPEG, etc.). For example,
<pre>&nbsp;&nbsp;&nbsp; ($width, $height, $size, $format) = split(',', $image->Ping('logo.png'));</pre>
This is a more efficient and less memory intensive way to query if an image
exists and what its characteristics are. Note, only information about the
first image in a multi-frame image file is returned.
<p>You can optionally add <tt>Image</tt> to any method name above. For
example, <tt>PingImage</tt> is an alias for method <tt>Ping</tt>.
<p>Use <tt>RemoteCommand</tt> to send a command to an already running <a href="display.html">display</a>
or <a href="animate.html">animate</a> application. The only parameter is
the name of the image file to display or animate.
<p>Finally, for convenience, method <tt>QueryColor</tt> accepts one or
more color names or hex value and returns their respective red, green,
and blue color values:
<pre>&nbsp;&nbsp;&nbsp; ($red, $green, $blue, $opacity) = split(', ', $image->QueryColor('cyan'));
&nbsp;&nbsp;&nbsp; ($red, $green, $blue, $opacity) = split(', ', $image->QueryColor('#716bae'));</pre>
</dl>
<a href="#contents">Back to Contents</a>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="erro"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Handling
Errors</font></font></font></b></td>
</tr>
</table>

<dd>
All <b>PerlMagick</b> 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 errors are returned for the different methods:</dd>

<ul>
<li>
Methods which return a number (e.g. <tt>Read</tt>, <tt>Write</tt>):</li>

<pre>&nbsp;&nbsp;&nbsp; $x = $image->Read(...);
&nbsp;&nbsp;&nbsp; warn "$x" if "$x";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # print the error message
&nbsp;&nbsp;&nbsp; $x =~ /(\d+)/;
&nbsp;&nbsp;&nbsp; print $1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # print the error number&nbsp;
&nbsp;&nbsp;&nbsp; print 0+$x;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # print the number of images read</pre>

<li>
Methods which operate on an image (e.g. <tt>Zoom</tt>, <tt>Crop</tt>):</li>

<pre>&nbsp;&nbsp;&nbsp; $x = $image->Crop(...);
&nbsp;&nbsp;&nbsp; warn "$x" if "$x";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # print the error message
&nbsp;&nbsp;&nbsp; $x =~ /(\d+)/;
&nbsp;&nbsp;&nbsp; print $1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # print the error number</pre>

<li>
Methods which return images (<tt>Average</tt>, <tt>Montage</tt>, <tt>Clone</tt>)
should be checked for errors this way:</li>

<pre>&nbsp;&nbsp;&nbsp; $x = $image->Montage(...);
&nbsp;&nbsp;&nbsp; warn "$x" if !ref($x);&nbsp; # print the error message
&nbsp;&nbsp;&nbsp; $x =~ /(\d+)/;
&nbsp;&nbsp;&nbsp; print $1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # print the error number</pre>
</ul>
Here is an example error message:
<pre>&nbsp;&nbsp;&nbsp; Error 400: Memory allocation failed</pre>
Below is a list of error and warning codes:
<table BORDER >
<caption>Error and Warning Codes</caption>

<tr>
<th>Code</th>

<th>Mnemonic</th>

<th>Description</th>
</tr>

<tr>
<td>0</td>

<td>Success</td>

<td>method completed without an error or warning</td>
</tr>

<tr>
<td>300</td>

<td>ResourceLimitWarning</td>

<td>a program resource is exhausted (e.g. not enough memory)</td>
</tr>

<tr>
<td>305</td>

<td>XServerWarning</td>

<td>an X resource is unavailable</td>
</tr>

<tr>
<td>310</td>

<td>OptionWarning</td>

<td>a command-line option was malformed</td>
</tr>

<tr>
<td>315</td>

<td>DelegateWarning</td>

<td>an ImageMagick <i>delegate</i> returned a warning</td>
</tr>

<tr>
<td>320</td>

<td>MissingDelegateWarning</td>

<td>the image type can not be read or written because the appropriate <i>Delegate</i>
is missing</td>
</tr>

<tr>
<td>325</td>

<td>CorruptImageWarning</td>

<td>the image file may be corrupt</td>
</tr>

<tr>
<td>330</td>

<td>FileOpenWarning</td>

<td>the image file could not be opened</td>
</tr>

<tr>
<td>335</td>

<td>BlobWarning</td>

<td>a binary large object could not be allocated</td>
</tr>

<tr>
<td>340</td>

<td>CacheWarning</td>

<td>pixels could not be saved to the pixel cache</td>
</tr>

<tr>
<td>400</td>

<td>ResourceLimitError</td>

<td>a program resource is exhausted (e.g. not enough memory)</td>
</tr>

<tr>
<td>405</td>

<td>XServerError</td>

<td>an X resource is unavailable</td>
</tr>

<tr>
<td>410</td>

<td>OptionError</td>

<td>a command-line option was malformed</td>
</tr>

<tr>
<td>415</td>

<td>DelegateError</td>

<td>an ImageMagick <i>delegate</i> returned a warning</td>
</tr>

<tr>
<td>420</td>

<td>MissingDelegateError</td>

<td>the image type can not be read or written because the appropriate <i>Delegate</i>
is missing</td>
</tr>

<tr>
<td>425</td>

<td>CorruptImageError</td>

<td>the image file may be corrupt</td>
</tr>

<tr>
<td>430</td>

<td>FileOpenError</td>

<td>the image file could not be opened</td>
</tr>

<tr>
<td>435</td>

<td>BlobError</td>

<td>a binary large object could not be allocated</td>
</tr>

<tr>
<td>440</td>

<td>CacheError</td>

<td>pixels could not be saved to the pixel cache</td>
</tr>
</table>

<p>The following illustrates how you can use a numeric status code:
<pre>&nbsp;&nbsp;&nbsp; $x = $image->Read('rose.png');
&nbsp;&nbsp;&nbsp; $x =~ /(\d+)/;
&nbsp;&nbsp;&nbsp; die "unable to continue" if ($1 == ResourceLimitError);</pre>
</dl>
<a href="#contents">Back to Contents</a>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="blobs"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Working
with Blobs</font></font></font></b></td>
</tr>
</table>

<dd>
A blob contains data that directly represent a particular image format
in memory instead of on disk. <b>PerlMagick</b> supports blobs in any of
these image <a href="formats.html">formats</a> and provides methods to
convert a blob to or from a particular image format.</dd>

<table BORDER >
<caption>Blob Methods</caption>

<tr>
<th>Method</th>

<th>Parameters</th>

<th>Return Value</th>

<th>Description</th>
</tr>

<tr>
<td>ImageToBlob</td>

<td>any image <a href="#seta">attribute</a></td>

<td>an array of image data in the respective image format</td>

<td>convert an image or image sequence to an array of blobs</td>
</tr>

<tr>
<td>BlobToImage</td>

<td>one or more blobs</td>

<td>the number of blobs converted to an image</td>

<td>convert one or more blobs to an image</td>
</tr>
</table>

<p><tt>ImageToBlob</tt> 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:
<pre>&nbsp;&nbsp;&nbsp; @blobs = $image->ImageToBlob();
&nbsp;&nbsp;&nbsp; open(DISPLAY,"| display -") || die;
&nbsp;&nbsp;&nbsp; binmode DISPLAY;
&nbsp;&nbsp;&nbsp; print DISPLAY $blobs[0];
&nbsp;&nbsp;&nbsp; close DISPLAY;</pre>
Method <tt>BlobToImage</tt> returns an image or image sequence converted
from the supplied blob:
<pre>&nbsp;&nbsp;&nbsp; $blob=$db->GetImage();
&nbsp;&nbsp;&nbsp; $image=Image::Magick->new(magick=>'jpg');
&nbsp;&nbsp;&nbsp; $image->BlobToImage($blob);</pre>
</dl>
<a href="#contents">Back to Contents</a>
<br>&nbsp;
<br>&nbsp;
<dl><a NAME="copy"></a>
<table BORDER=0 WIDTH="100%" >
<tr>
<td ALIGN=LEFT BGCOLOR="#52799E"><img SRC="../images/right_triangle.png" ALT=">" BORDER=0 height=14 width=15><b><font face="Helvetica, Arial"><font color="#FFFFFF"><font size=+1>Copyright</font></font></font></b></td>
</tr>
</table>

<dd>
<b>Copyright (C) 2000 ImageMagick Studio</b></dd>

<dd>
<b>Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files ("PerlMagick"),
to deal in PerlMagick without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of PerlMagick, and to permit persons to whom the PerlMagick
is furnished to do so, subject to the following conditions:</b></dd>

<dd>
<b>The above copyright notice and this permission notice shall be included
in all copies or substantial portions of PerlMagick.</b></dd>

<dd>
<b>The software is provided "as is", without warranty of any kind, express
or implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and noninfringement.In no event shall
ImageMagick Studio be liable for any claim, damages or other liability,
whether in an action of contract, tort or otherwise, arising from, out
of or in connection with PerlMagick or the use or other dealings in PerlMagick.</b></dd>

<dd>
<b>Except as contained in this notice, the name of the E. I. du Pont de
Nemours and Company shall not be used in advertising or otherwise to promote
the sale, use or other dealings in PerlMagick without prior written authorization
from the ImageMagick Studio.</b></dd>
</dl>
<a href="#contents">Back to Contents</a>
<hr>
<dl><a href="../ImageMagick.html"><img SRC="../images/home.png" ALT="Home Page" BORDER=0 height=40 width=40 align=CENTER></a><font size=-2>
Image manipulation software that works like magic.</font></dl>

</body>
</html>
