[Melbourne-pm] Image Manipulation
Rick Measham
rick at measham.id.au
Fri Apr 28 14:41:20 PDT 2006
Scott Penrose wrote:
> 3) Write an external wrapper - yet another abstraction, just for the
> most basic of functions - height, width, resize, rotate... Really the
> same as 2 but make it more usable outside. A little harder to write, new
> tests, module space etc.
>
> My current thoughts is leaning in on 2.
>
> 3 worries me a little for two reasons: It is an unnecessary abstraction
> - using the Simple driver of Gallery you can already achieve what you
> would otherwise with 3, so just use Gallery (this is a sort of); where
> would it go, it seems that people writing modules such as
> "Image::Resize" have this sort of in mind, but have limited to one
> function, and one backend.
G'day Scott,
I started working on (3) a couple of years ago and stopped when my
interest waned. If you want to go that way, then I'm happy to pick it up
again and release it.
I think I called it Graphics::Abstract.. it had no requirements of its
own, however you could then install Graphics::Abstract::ImageMagick or
Graphics::Abstract::GD (or ...) which would each have a dependency on
their given CPAN Module.
Internally we check if the ImageMagick plugin is installed as it's the
most feature-filled plugin, then degrade slowly. (Latter thoughts
include writing to Graphics::Abstract::Config in the make process each
time a plugin is installed, which would mean we don't have to keep
trying to load stuff :) )
Of course, each of these plugins has fewer features than others and so
you'd need to be checking for error messages. This makes manipulation
chaining difficult, though it will be possible:
$gfx->rotate(90)->flip->resize(800,600);
print $gfx->errmsg();
# The GD library does not support flip(). Please consider installing
Graphics::Abstract::ImageMagick
Anyway, if you're interested, I'll pick it back up again :)
Cheers!
Rick Measham
More information about the Melbourne-pm
mailing list