Item Description: Manipulate picture files in various file formats

Review Synopsis: If you can stand the weight, this is the only tool you need for image manipulation

Update:The Image Magick URL was updated, thanks to the good folks notifying me.

Image::Magick (also called PerlMagick) is the Perl wrapper for Image Magick, a feature rich command line image manipulation program.

What's good ?

If you have to manipulate images (crop, resize, convert, montage, grayscale, paint), Image::Magick is the thing for you. The ImageMagick suite of programs is seasoned and converts images between a set of claimed 68 different formats. If you're thinking about rolling your own image decoder, think if maybe ImageMagick already does the stuff for you.

ImageMagick (and Image::Magick) is available for a lot of platforms, ranging from Win32 to VMS and OS/2.

Image::Magick is used widely for creating images, for example the GeoCities banner generator uses Image::Magick.

What's bad ?

ImageMagick is written in C. While there is not that much bad about this immediately, this means, you have to find and install a version of ImageMagick written for your platform.

The second thing is, that Image::Magick also needs some XS compiled, which means that you will need some way to compile the XS for your target machine. ActiveState has a Image::Magick for Perl 5.005_03 (build 522), but there is no Image::Magick package for Perl 5.6 (build 613+) - a nasty thing to find out after you upgrade.

The third thing that might keep you from using Image::Magick is, that it is a bit overkill for some jobs. If you only need the dimensions of an image, think about using Image::Size, and if the image types you want to accept are limited (think PPM), a Perl decoder might be faster at load time/run time than Image::Magick. But Image::Magick saves you the trouble of finding a correct specification for your particular image format and you can add new file formats easily.

Things of note

The interface documentation for the Perl interface is installed with the main ImageMagick package, the Image::Magick package itself comes without documentation. The documentation itself leaves some bits wishing, it takes some experimentation until you get the parameter names right for every function call you can make. Other than that, the design is OK, you instantiate an Image::Magick object, into which you can load one or more images, you convert them and then you write them out to disk using the methods of the object. This is mainly efficient for converting large batches of images.

If you can't get Image::Magick to work from within Perl, there is always the backup method of using shell commands to convert and mogrify, which are two command line programs that act as call-ins to the ImageMagick libraries as well.

Replies are listed 'Best First'.
Re: Image::Magick
by jeroenes (Priest) on Nov 24, 2000 at 19:19 UTC
    The url for the imageMagick homepage is no longer valid, they have their own domain now. new link


    I was dreaming of guitarnotes that would irritate an executive kind of guy (FZ)

RE: Image::Magick
by fundflow (Chaplain) on Oct 26, 2000 at 17:28 UTC
    Just to emphesize, ImageMagick is much slower than ought to be. It also consumes more memory than other tools. That said, it is very general and supports many platforms and is a great tool for basic image manipulation.

    Just not for resource-limited operations, such as web serving.

Re: Image::Magick
by andye (Curate) on Nov 24, 2000 at 18:13 UTC
Re: Image::Magick
by perlmonkey (Hermit) on May 07, 2001 at 01:04 UTC
    I dont know if it is just my system, but my application took at least twice as long to 'convert' an image usage the PerlMagick than it did to just call the convert binary via a system call. For this reason I had to back out the PerlMagick changes and stay with the system calls. I have no idea why the time difference would be so significant though.
      How to i implement resizing images? how to i get perl module for file. Its free or any payment. In Pdk kit is not available Just convey how to proceed further. Let me know If any one help me Murugavel Ramachandran My email Id :
        I am trying to increase the number of colors in an image, but it is not working.
        $img = Image::Magick->new; $img->Read('../images/logo.gif'); my $nu = $img->Get('colors'); $img->Set(colors=>256); $img->Quantize(); my $nu1 = $img->Get('colors');
        nu and nu1 remains the same- 127 in my case. Any help is appriciated.
Re: Image::Magick
by josera (Beadle) on Aug 04, 2005 at 10:12 UTC
    All this information is very interesting
    I'm trying to run perlmagick to run html2ps, and my problem is that i'm working in windows and i have got installed perl 5.8, and the binary files that i've found are for perl 5.6.
    I have get to work the perlmagick installing perl 5.6 (so now i have perl 5.6 and perl 5.8 in my computer, that it isn't very recommendable).
    Another problem is that i can't compile the modules because i can't install more programs (perl 5.6 only was uncompressed).
    Where can i find the binary release of perlmagick for 5.8? I've found this page (, but this binary is for perl 5.6
    Can anyone help me?
    Thanks you,
    José Ramón