Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

comment on

( #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":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (3)
    As of 2020-06-04 22:18 GMT
    Find Nodes?
      Voting Booth?
      Do you really want to know if there is extraterrestrial life?

      Results (35 votes). Check out past polls.