Book Reviews

The following book reviews are the copyright of their respective authors and no part should be reproduced without the express permission of the author. Publishers and Authors of the books reviewed may reproduce the whole or extracts of a review for their book. To request copyright permission please email

All the reviews herein are the opinions of the reviewer and are not necessarily the views of Birmingham Perl Mongers and its members. If you feel a review or comment has been made in error, please contact to rectify the situation.

Perl Books

Static Link:

Graphics Programming with Perl
Title:Graphics Programming with Perl
Author(s):Martien Verbruggen

When I first discovered Perl had the capability to create dynamic images I was amazed, but never got around to finding out how to do it. This book gave me the excuse to learning something different. Perviously my Perl Graphics experience was limited to Image::Size, which is covered here, but there is a wealth of graphic manipulation tools that I never knew about.

The first three chapters cover the basics, explaining the different colour maps, graphics formats and CPAN modules that are available.

Having laid the ground work, Chapter 4 gives you have everything you need to know to create some pretty complex drawings. Surprisingly enough the GD and Image::Magick tools are explained in a easy manner that hides the real complexity of what lies beneath. The GIF/PNG issue is covered, as well as the incompatibilities between GD and Image::Magick. But rather than just throw in the problems, the author goes through the solutions too.

Chapter 5 covers the Graph/Chart and Plotting modules, of which there are many more than I expected. I hadn't thought of using Pie Charts or Line Graphs before, but having read this chapter I was impressed enough to start think about what uses I could provide Charts for :)

Chapter 6 is probably the most useful to the majority of readers as it concerns graphics for the web. The author emphasises the use of -wT and strict, together with use CGI, which is a good thing as I still get surprised how many people don't. There are two big problems for graphics on the web, the first is the colour depth when they're viewed in low resolution. Thankfully both GD and Image::Magick both have the ability to match the palette to "web safe" colours. The second problem is resolution itself. It is painful sometimes to wait for a page of images to appear simply because the graphics are too big. Again scaling the image can be handled by both GD and Image::Magick. The author uses the photo album as a good example, with an index of thumbnails to the real pictures.

The next chapter deals with the many different animation formats available, some simple such as GIF, others are far more complex such as Flash. Unfortunately due to the complexities only GIF and MNG, using Image::Magick and GIMP are covered here. There is a reference to the use of Flash and Perl, but the author only has a footnote. However, the majority of readers are likely to get a lot out of the chapter, but it would be nice to see further references to the Flash/Perl experience in future editions.

The Resizing and Combining Images chapter describes a set of very useful image manipulation tools. There are many alterations and filters you can perform on images, such as adding watermarks and cropping, that are covered here.

Chapter 9 covers 3D graphics, which really only skims the surface. I once had a brief look at POVRay a number of years ago and understand how complex 3D imaging can be. The chapter here looks at the Perl interfaces to OpenGL and RenderMan, which provide the graphics engine. Most 3D graphics are generate with very complex algorithms and as such Perl isn't really the tool best suited to the actual creation, but it can supply the commands. The author covers some very simple 3D images, spheres and cubes, and allows a lot of defaults in order to simplify the examples. Its enough to get you interested, but complex scenes such as a glass bottle or a light bulb, requires a lot more know how than is provided here.

Part 3 of the book looks at the extendible part of graphics programming. Chapter 10 looks at the concerns of writing your own graphics module, which is pretty standard when creating any module, the graphic specific aspect is just recognising the difference between a GD and Image::Magick interface. The text manipulation tools covered in Chapter 11, and the channel and transparency covered in Chapter 12 however are much more intriguing. The ability to manipulate individual pixels and power that Inline::C can provide, might not be used by everyone, but should you ever need to try it out, the details are here.

Appendix A details the interface to Image::Magick in depth, and Appendix B provides some useful colour translation algorithms.

If you're thinking of looking into image creation and manipulation, then this books does get you started, but be prepared to read the documentation too. The book works well as a complete book as well as providing you with the ability to just dip in and take what you need. I thought the examples were well placed and gave you the groundwork to understand how to develop scripts further.

I have been warned of the awkwardness of installing glib, which is the behind the scenes graphics engine that GD and Image::Magick use, but thankfully my newly installed RH7.3 installed it for me. I haven't tried this on a Windows machine, but I imagine it's not so easy. However, that isn't the fault of the book.

All in all I found this a great introduction to a large number of graphics modules, and the abilities they possess. If you want to learn about Graphics Programming with Perl then this is definitely a book to read.