You can at least create an image from scratch without reading some
external image; below the image 'xc:white' is one of some internal types. (This is probably the same as the "canvas" mentioned earlier".) I don't find this onerous, since I usually want to write on some base color. Maybe there's another way to do it.
Code: Select all
$image = Image::Magick->new(size=>"100x100");
$image->ReadImage('xc:white');
$image->Draw(primitive=>'circle', points=>"50,50 50,20", fill=>'blue');
$image->Write("newImageTest.png");
That's a pretty crude example; of course one should always check for warnings and errors...
Code: Select all
...
$notOk = $image->Draw(primitive=>'circle', points=>"50,50 50,20", fill=>'blue');
die "Killing me softly with $notOk" if $notOk;
...
Speaking of frustrating gaps in the PerlMagick doc, I recently shared your experience with
image sequences. There are many instances in the doc of what one can do with a sequence of images (modify them, take their average, etc), but how to make a sequence from scratch? It's nowhere in the doc. Finally I found something buried in some sample script that was created when my PerlMagick was built: use
push. Start with a new empty image and push more images onto it. Again, there might be a better way, but at least this works for me. I do need to create some first image from scratch, but that's above. If that
$image already exists, then below I get a sequence of 10 copies.
Code: Select all
$imageSequence = new Image::Magick;
map {push @$imageSequence, $image->Clone()} (1..10);
(I might be violating Perl etiquette by using
map over a bogus 10-element array. Maybe a
for loop is better.)
Next frustrations: Blobs and Direct Pixel Access...
Cheers and good luck,
Rick
P.S. Everyone understands how limited the IM team's resources are, so expressing frustrations with the docs should not be construed to be schimpfing or critical. If more time were spent on the docs, fewer IM toys may have been developed to play with in the first place; they are the same folks who do most of this. We get it. On the other hand, it is fair to wonder where the sweet spot is --- with better docs might come better participation, which might lead to a virtuous cycle of more development and better docs...