in reply to Creating thumbnails
use Carp; use Image::Magick; ... # makethumbnail( jpeg-data ) # creates a thumbnail with maximum size 120x120 sub makethumbnail { my $data = shift; my $image=Image::Magick->new(magick=>'JPEG'); my $res; $res = $image->BlobToImage($data); if ($res) { carp("makethumbnail: Error reading image - $res\n"); return undef; } $res = $image->Transform(geometry=>'120x120'); if ($res) { $res = $image->Resize(geometry=>'120x120'); if ($res) { carp("makethumbnail: Error while resizing: $res\n"); return undef; } } my @blob = $image->ImageToBlob(); if ($#blob!=0) { carp("makethumbnail: Error while converting to blob\n"); return undef; } return $blob[0]; }
I seem to recall that the double command for resizing depends on the interface changing at some point.
Cheers
|
---|