Image::Magick::Thumbnail - Produces thumbnail images with ImageMagick
use Image::Magick::Thumbnail 0.06; # Load the source image my $src = Image::Magick->new; $src->Read('source.jpg');
# Create the thumbnail from it, where the biggest side is 50 px my ($thumb, $x, $y) = Image::Magick::Thumbnail::create($src, 50);
# Save your thumbnail $thumb->Write('source_thumb.jpg');
# Create another thumb, that fits into the geometry my ($thumb2, $x2, $y2) = Image::Magick::Thumbnail::create($src, '60x50');
# Create yet another thumb, fitting partial geometry my ($thumb3, $x3, $y3) = Image::Magick::Thumbnail::create($src, 'x50');
__END__
This module uses the ImageMagick library to create a thumbnail image with no side bigger than you specify.
There is no OO API, since that would seem to be over-kill. There's just create
.
my ($im_obj, $x, $y) = Image::Magick::Thumbnail->create( $src, $maxsize_or_geometry);
It takes two arguments: the first is an ImageMagick image object,
the second is either the size in pixels you wish the longest side of the image to be,
or an Image::Magick
-style 'geometry' (eg 100x120
) which the thumbnail must fit.
Missing part of the geometry is fine.
Returns an Imaeg::Magick
image object (the thumbnail), as well as the
number of pixels of the width and height of the image, as integer scalars,
and (mainly for testing) the ration used in the scaling.
Will warn on bad or missing arguments if you have use
d warnings
.
Image::Magick
None by default.
the perl manpage, the Image::Magick manpage, the Image::GD::Thumbnail manpage, and the Image::Thumbnail manpage for the same formula for various engines.
Lee Goddard <LGoddard@CPAN.org>
Copyright (C) Lee Godadrd 2001-2008. all rights reserved. Available under the same terms as Perl itself.