Whenever I need to do a lot of complicated image processing, I use Image::Magick; simpler stuff I typically use Imager. Although GraphicsMagick claims to be superior to ImageMagick, they're perl support is lacking. One of the developers claims that the GraphicsMagick module "is one of the most complicated PERL modules in existence" and therefore will never be submitted to CPAN:
I've been using PerlMagick for years for most of my image processing need. My Flickr Magick set on Flickr contains a lot of examples of the kind of wizardry you can accomplish with this library.
While GD is fine for basic stuff, I found it wasn't nearly comprehensive enough. My photomosaic software, used to develop the Flickr mosaics in the above set, and included in my O'Reilly book Flickr Hacks was developed using PerlMagick.
In addition, I've used it to generate images for my puzzle website, krazydad.com/
Things I love about PerlMagick/ImageMagick:
1) Lots of different resampling algorithms. Most other image processing libraries have just one resampling algorithm. Not every resampling algorithm is appropriate for every job.
2) Insanely featureful 'Annotate' method
3) Pixel level manipulation of images.
4) For a lot of tasks (such as batch image resizing), you can bypass PerlMagick and just shell out to the command line tools provided with ImageMagick (convert, montage and so on). This is the equivalent of using the command line curl instead of the curl library.
5) It wasn't designed for making simple business graphics. It was designed to do image processing (to some this may be a negative, but if you're looking for general-purpose image processing, this is the tool, not GD).
Now here's the down side: ImageMagick and PerlMagick are a *bitch* to install, especially on OSX, these days. The problem is that ImageMagick has a huge number of dependencies, and the software is mature enough that it tends to lose its maintainers, so that the old installs that are floating around (on Fink, Macports, Homebrew, or whatever) tend to become stale and broken. Pretty much every time I get a new Mac, I go through hell trying to get a working PerlMagick system. Supposedly, GraphicsMagick was supposed to solve these kinds of instability problems, but it too is quite long-in-the-tooth, and I've never had much long installing it either.
excellent package ! excellent lib
ImageMagick is a feature rich, but heavy library. GD is better for simple tasks. And the interface is not perlish.
But the below review "was" (Edited per Lee Goddard's update :) misleading, since ImageMagick does have a QueryFontMetrics() method:
($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $image->QueryFontMetrics(parameters);
PerlMagick (Image::Magick) is the perl XS interface to the powerful, Photoshop-/Gimp-like image manipulation library housed at imagemagick.org.
Features include drawing routines, a huge number of filters - including a variety of user-definable kernel processors - TrueType font rendering, histogram extraction, profile- and metadata-manipulation, writing in a variety of formats.
Documentation in the Perl module is non-existant, and although it can be found on the web easily enough, it does not do the product justice. You may well find yourself reading the C API documentation to understand some of the functions, methods and arguments.
Error handling is most un-perlish, and should after the many years of this module's existance, have been improved.
Installation is always a pain in the neck: the Perl module requires you pre-install the Imagemagick.org binaries - on Win32l the PPM comes with the binaries, and not the other way around. Be sure to check you are using the correct 'quantum' version: Q8 is fast but Q16 provides more detailed understanding of colour.
In short, if you need to plot a few lines, use GD. If you haven't tried Imager (imager.perl.org), give it a shot before investing your time in Imagemagick.
(Kuszi, Burak for the QueryFontMetrics tip: proves my point about the docs ;-)
Image::Magick is a powerful image processing tool and handles many formats. I have used it for making thumbnails and rounding the corners of images.
On the downside, it is significantly under-documented, and the ChangeLog file in the distribution stopped recording recent changes many versions ago. I have also experienced a number of a regressions with Image::Magick-- features quit working after an upgrade. Twice the functionality to created rounded corners has silently broken. Another time a particular kind of JPEG starting Image::Magick to run indefinitely. Yet another time, a trivial syntax change was needed after an upgrade which could have been avoided. Perhaps most seriously, it appears that after upgrading to 6.1.9, there was a bad memory leak that effectively took down a busy mod_perl enabled website which used it.
For these reasons, unless you need some cutting edge feature of Image::Magick, I recommend the Graphics::Magick fork. In my own testing, no code changes were needed besides the name change. Graphics::Magick has a focus on being more stable, and I believe it includes more automated tests in it's distribution.
Graphics::Magick is not on CPAN yet, but there are pre-made packages for many platforms that include the Perl module has part of the package.
Worderful work !
Image::Magick / PerlMagick (6.02)
So this is my favorite image manipulation library in perl. But frankly it has problems. It is often more difficult to install than it should be. It's interface is not in perlish. There are the occasional hidden gotchas in the interface. And the documentation is seriously lacking, on perl specific stuff. The general docs are fine.
All of this is outweighed by what it delivers, which is the most powerful, highest quality image manipulation library for perl. It's also available on a fairly wide range of platforms. On the balance a very good thing.
2 hidden unhelpful reviews