Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Chapter 5. Industrial-Strength Graphics ... > Learn PerlMagick in 21 Seconds - Pg. 114

Learn PerlMagick in 21 Seconds All of the PerlMagick methods and attributes are defined by the Image::Magick mod- ule. To make these methods and attributes available within the name space of your script, include this module with Perl's use function: use Image::Magick; You can then use the new constructor to create an image object that is capable of reading, manipulating, and writing images: $image = Image::Magick->new; # $image is a new image object Once you are finished with an image object, you should destroy it to conserve memory resources. Do this with undef : undef $image; # destroy an image object You can also "empty" all of the images from an object and keep the object around for further use with: undef @$image; undef $image->[2]; # delete all images from an object # delete only the third image from a sequence Here is a quick example script that exhibits most of the functionality of the Im- age::Magick module: #/usr/bin/perl -w use strict;