Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.

In reply to Image::Magick by Corion

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-05-30 07:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found