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

Using ImageMagick, how would you write an image to a specified folder? Using the below format, the image isn't written anywhere. I'm just trying to specify a folder for the image to get created into. $magick = $image->Write("/images/$filename");

Replies are listed 'Best First'.
Re: $image->Write("/folder??
by b10m (Vicar) on Jan 22, 2004 at 17:11 UTC

    I think this is a clear case of RTFM ;)

    Image::Magick will show you that there is a web page set up for this module. And on that webpage it shows you:

    To write an image in the PNG format to a PERL filehandle, use: $filename = "image.png"; open(IMAGE, ">$filename"); $image->Write(file=>\*IMAGE, filename=>$filename); close(IMAGE);

    Of course, $filename can contain a specific path.

    HTH,

    --
    b10m
      ehh not really a case of RTFM, his usage is also correct. From the same section, just a little higher up:
      $image->Write(filename=>'image.png', compression=>'None');

      This may sound like a "duh!" but does the directory you are trying to write to exist already? IM won't create a new directory.