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

Thumbnailing

You have a bunch of image files (or PostScript or PDF files) for which you would like to create smaller thumbnail images.

Requirements

ImageMagick with Ghostscript support

Solution

The ImageMagick package provides for several methods of thumbnailing images. One high-level method is the Visual Image Directory virtual file format that is defined by ImageMagick. You can convert a number of image files into a Visual Image Directory with the convert utility:

convert 'vid:*.gif' png:imageindex.png

If ImageMagick is installed on your system, this command will convert every GIF format file in the current directory into a single image that contains thumbnails of all of the images and will save it as a PNG file called imageindex.png. The resulting image will look like Figure 10.10.

ImageMagick’s Visual Image Directory format provides a quick and easy means of thumbnailing images

Figure 10-10. ImageMagick’s Visual Image Directory format provides a quick and easy means of thumbnailing images

The Visual Image Directory is essentially a high-level function that uses some of the lower-level ImageMagick routines to read in a bunch of images, scale them into thumbnails, provide borders, labels, drop shadows, and a background, and write it out to the appropriate file. You can access all of these functions via the PerlMagick interface to ImageMagick (described in Chapter 5).

The Visual Image Directory has a number of default parameters. It will automatically place at most six thumbnails in a ...

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