|Think about Loose Coupling|
Image::Magick: Still the best? Can it be improved?by ggvaidya (Pilgrim)
|on Oct 13, 2008 at 05:56 UTC||Need Help??|
ggvaidya has asked for the wisdom of the Perl Monks concerning the following question:
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:
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.