I have an image I have manipulated with GD::Image and I want to do further manipulations with Image::Magick. I'd like to avoid writing the image out to disk just so Image::Magick can read it in. Image::Magick's Read function will accept a filehandle as a parameter, so I'm trying to pass it an IO::Scalar object I created with the output from GD::Image.
However, since an IO::Scalar object can be treated as a string, it looks like Image::Magick is interpreting the contents of the image as a filename which it cannot find, and Read() fails.
Is there another way to create a filehandle from a scalar that behaves more like a regular filehandle, or is there another simpler way to accomplish what I'm trying to do here?
my $FH = new IO::Scalar \$image_bin;
my $magick = Image::Magick->new;
my $response = $magick->Read(file => $FH);
$response is:
"Exception 435: unable to open image `????': No such file or directory"