NAME

Image::Magick::Thumbnail - Produces thumbnail images with ImageMagick

SYNOPSIS

        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__

DESCRIPTION

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.

SUBROUTINE 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.

WARNINGS

Will warn on bad or missing arguments if you have used warnings.

PREREQUISITES

        Image::Magick

EXPORTS

None by default.

SEE ALSO

perl, Image::Magick, Image::GD::Thumbnail, and Image::Thumbnail for the same formula for various engines.

AUTHOR

Lee Goddard <LGoddard@CPAN.org>

COPYRIGT

Copyright (C) Lee Godadrd 2001-2008. all rights reserved. Available under the same terms as Perl itself.