andye has asked for the wisdom of the Perl Monks concerning the following question:

Hi folks, I'm having trouble with Image::Magick.

For some time it's been quite happily resizing gifs for me, now I want it to do the same with jpegs. Something's going wrong in the conversion to or from a blob - I've narrowed it down to the following:

#the original blob is in $blobdata - if I print it out here # then I can see it's fine (exists, looks right). #in the following line I've tried jpeg,jpg,JPG my $image=Image::Magick->new(magick=>'JPEG'); $image->BlobToImage($blobdata); my $newblob = $image -> ImageToBlob() ; print $newblob; #at this point, $newblob appears to be empty
Any ideas gratefully appreciated.

Cheers,
andy.

Replies are listed 'Best First'.
Re: Image::Magick BlobToImage() for jpegs
by andye (Curate) on May 04, 2001 at 15:45 UTC
    A bit more info: if I do
    my $image=Image::Magick->new(magick=>'jpg'); $image->BlobToImage($blobdata); use Data::Dumper; print Dumper($image);
    then I get
    $VAR1 = bless( [], 'Image::Magick' );
    so I guess it's BlobToImage() which is failing.

    andy.

Re: Image::Magick BlobToImage() for jpegs
by Sinister (Friar) on May 04, 2001 at 15:10 UTC
    would it not be easier just to use the Resize function?

    Sinister greetings.
      I plan to. But I have to convert it from a blob first. I've trimmed my code to find the broken part - and it appears to be the blob/image/blob conversion.

      andy.

        Why do you need to specify the type of the image when defining it?

        Sinister greetings.