O'Reilly logo

Programming Web Graphics with Perl and GNU Softwar by Shawn Wallace

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Seven Easy Pieces with PerlMagick

Because the PerlMagick module implements the full GIF89a specification and allows us to include multiple images in a single file, we will use it to create some useful solutions to common GIF animation problems. Two of the seven following “recipes” show examples of moving graphical elements called sprites around in an animation (Section 9.2.1 and Section 9.2.2); two illustrate some built-in features of PerlMagick that simplify certain tasks (Section 9.2.3 and Section 9.2.4); one is a utility script for breaking an image into a regular grid so that parts of it can be animated separately (Section 9.2.6); one shows a combination of image- splitting and applying an effect iteratively by allowing you to define a window through which a graphic can continuously scroll (Section 9.2.5); and the last example reconstructs a split image by generating an HTML table (Section 9.2.7).

But first, a quick review of PerlMagick concepts. PerlMagick uses an object interface to its methods and attributes. An image object that has been instantiated with new Image::Magickcan read in image files of many formats with the Read( ) method. An image object may be passed to another image object with the Clone( ) method. Several images can reside within the same image object. Each of these individual images are referred to as scenes and can be retrieved by treating the object as a reference to an array. For example:

$image2 = $image1->[3]->Clone();

In this line, the image object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required