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