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.
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.
Image::Magick
100x120
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.
Imaeg::Magick
Will warn on bad or missing arguments if you have used warnings.
use
warnings
None by default.
perl, Image::Magick, Image::GD::Thumbnail, and Image::Thumbnail 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.
To install Image::Magick::Thumbnail, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::Magick::Thumbnail
CPAN shell
perl -MCPAN -e shell install Image::Magick::Thumbnail
For more information on module installation, please visit the detailed CPAN module installation guide.