Subject: | SaveFile of newly created image |
Date: | Sat, 16 Jun 2012 10:12:50 +1000 |
To: | bug-Wx-Perl-Imagick [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
newsave.pl below attempts to start a new image by width and height, but
it prints
ret is "Exception 410: no images defined `Image::Magick' @ error/Magick.xs/XS_Image__Magick_Write/14059"
cat: /tmp/newsave.xpm: No such file or directory
where I hoped it would create a file /tmp/newsave.xpm.
In some other imagemagick code I'd found I had to start a new blank
image with
$imagemagick->ReadImage('xc:black');
I never entirely understood it, but it's something about an imagemagick
starting life with no images at all in it and you have to set
width,height and then read from all-black to make one.
#!/usr/bin/perl -w
use strict;
use Wx;
use Wx::Perl::Imagick;
my $image = Wx::Perl::Imagick->new (20,10);
my $filename = '/tmp/newsave.xpm';
my $ret = $image->SaveFile($filename);
print "ret is \"$ret\"\n";
system ("cat $filename");
exit 0;