in reply to reading image blob w/Image::Magick

The PerlMagick docs have a 'Working with Blobs' section -- there are ImageToBlob() and BlobToImage() methods ..

Also, you could use IO::Scalar to create a filehandle for the string and pass that to Image::Magick

Replies are listed 'Best First'.
Re^2: reading image blob w/Image::Magick
by salva (Canon) on Apr 16, 2006 at 21:43 UTC
    the objects provided by modules like IO::Scalar are not backed by real file descriptors at the OS level, and so, they can not be passed to C functions requiring open files as arguments (unless those functions have been modified to use PerlIO, but this is quite rare).
      Image::Magick can read from perl filehandles though:
      $image = Image::Magick->new; open(IMAGE, 'image.gif'); $image->Read(file=>\*IMAGE); close(IMAGE);
      despite that, IO::Scalar wouldn't work?
        open(IMAGE, 'image.gif') opens a real file using the OS services but IO::Scalar objects exists only inside perl.

        You can see the difference using the fileno() builtin:

        open IMAGE, "image.gif"; printf "fn: %d\n", fileno(IMAGE); my $ios = IO::Scalar->new; printf "fn: %d\n", fileno($ios);