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

comment on

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

Greetings fellow monks,

On my current project, we need to be able to accept a number of image formats from our users. The easiest way to achieve this is by using Image::Magick, which handles a very large number of input formats, and using it to convert the input file into a standard image format, such as LosslessJPEG.

The Image::Magick module is a very straightforward wrapper around the ImageMagick library, because of which it has lots of C-isms (not having thrown exceptions, methods returning complicated numbered error messages, and so on) as well as ImageMagick's own limitations (returning descriptive names instead of standard MIME types, for instance).

I've got two questions:

  1. Is ImageMagick still the best library for image conversion on Windows in Perl? Are there better libraries out there which I haven't heard about?
  2. Since I am going to be collating all my Image::Magick fixes into one module anyway, does it make sense to package this into an Image::Magick::Image module, which will encapsulate a single ImageMagick image? This module can then provide exceptions on input/output methods, make it easier to access image attributes, and generally fix up ImageMagick's more irritating warts. Do you think there is a need for such a module? Would it be worth the effort of packaging it for CPAN?

Thanks for your help!

Update: Removed reference to Image::Magick being procedural; this was just plain wrong. Thanks, mirod!

Update Oct 24, 2008: Matt Trout recommended that I use Image::Magick::Object (or my own variant on his suggestion, Image::Magick::Wrapper) as an overall package name. Individual images can then be wrapped by Image::Magick::Wrapper::Image, and we could wrap other IM objects as well - a path could be Image::Magick::Wrapper::Path, for instance. Much easier to extend functionality that way. My only worry is that names will get overly complicated. Any comments/suggestions?

Update Oct 24, 2008: It's going to take a couple of weeks at least to get my very small codebase released to CPAN. I've only got about three operations wrapped so far: Read(), Write(), and converting some of Image::Magick's inbuilt format names to standard MIME types. If anybody else feels like going ahead with this, please do! Otherwise, I'll make good my promise and make sure I get a very early release sometime in November. Once it's out under a good license, interested parties can get cracking on wrapping all of Image::Magick.

In reply to Image::Magick: Still the best? Can it be improved? by ggvaidya

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 meditating upon the Monastery: (3)
As of 2024-06-23 07:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.