in reply to Image::Magick and reading images from variables.

Hi BMaximus,

You want to use BlobToImage(), like this:

my $image=Image::Magick->new(magick=>'gif'); $image->BlobToImage($blobdata);
You probably want to check that what you have *really is* a gif before you do anything with it though, otherwise ImageMagick will crash fairly horribly.

Also have a look at ImageToBlob() (does the obvious).

Docs are here: http://www.imagemagick.org/www/perl.html#blobs

Oh, and if you're using if for the web, it's probably good to have a cacheing proxy in front of it, if it's going to see much use, since ImageMagick is not all that nippy. We use Squid.

andy.

Update: I don't know why I assumed it was a gif. If the image could be more than one format, you could presumably call Image::Magick->new() without parameters, load the blob and use Image::Magick itself to detect the format. I haven't tried this though.

Replies are listed 'Best First'.
Re: Re: Image::Magick and reading images from variables.
by BMaximus (Chaplain) on Mar 28, 2001 at 02:06 UTC
    Thank you very much. I guess at 5am in the morning when your tired and bleary eyed you miss a lot of things. I was looking at that page and I seemed to have missed it.

    BMaximus