Why doesn't this script work?

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
Cymro

Why doesn't this script work?

Post by Cymro »

I am new to this and based on the examples I have written this script.


use Image::Magick;
$image=Image::Magick->new;
$image=Image::Magick->new(size=>'640x480');
$text = 'Works like magick!';

$image->Annotate(font=>'kai.ttf', pointsize=>40, fill=>'green', text=>$text);
print "about to write\n";
$image->Write("output.png");
print "after writing\n"


It produces this output.

about to write
after writing

BUT NO IMAGE in the directory.

There are no error messages. I am running it under Ubuntu Linux
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Why doesn't this script work?

Post by magick »

You need to create an image canvas with
  • $image->read('xc:red');
Don't forget to check any exceptions returned by PerlMagick methods.
Post Reply