Chapter 5. Industrial-Strength Graphics Scripting with PerlMagick

PerlMagick is an object-oriented Perl interface to the ImageMagick image manipulation libraries. It is probably more accurate to call it the Image::Magick Perl module. It is a more robust collection of tools than GD. In addition to GIF it can read and write many file formats including PNG, JPEG, PDF, EPS, and Photo CD. In fact, PerlMagick is a graphics acronym goldmine with over 60 different file formats supported. Unlike GD, ImageMagick provides methods for creating animated GIFs dynamically. It can be used effectively in CGI applications, but its real strength is as an offline workhorse for the batch conversion and manipulation of images. This chapter will illustrate both uses and provide a complete overview of the functions available within PerlMagick.

Some PerlMagick applications that are particularly useful when programming for the Web include:

  • Creation of animated GIFs

  • Creation of composite images from a sequence

  • Easy reduction or thumbnailing of images (see also Chapter 10)

  • Setting transparent colors

  • Color reduction and optimization for various browsers

  • Conversion between 60+ formats (e.g., Photo CD to JPEG, PDF to GIF, GIF to PNG)

  • Special effects and addition of text to images

  • Gamma-correction of images for color-sensitive web applications

PerlMagick is used in a number of chapter in this book. See especially Chapter 9, and Chapter 10 for some elaborate working examples using PerlMagick.

Learn PerlMagick in 21 Seconds ...

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.