Page 1 of 1

Draw fill default

Posted: 2006-12-23T11:33:00-07:00
by rmabry
From the command line, the following generates a triangle filled with black, so it seems the default is the same as if adding -fill black.

Code: Select all

convert -size 150x100 xc:white -stroke red -strokewidth 4 -draw "polygon 20,20 130,20 130,80" filltest-cmd.png
However, in PerlMagick, the following generates an unfilled triangle, so the default is the same as if adding fill => 'none'.

Code: Select all

#!/usr/bin/perl -- 
use Image::Magick;
my $image = new Image::Magick;
$image->Set(size => '150x100');
$image->Read('xc:white');
$image->Draw(primitive=>'polygon', points=>'20,20 130,20 130,80', 
	stroke=>'red', strokewidth=>4);
$image->Write('filltest-pl.png');
Which is desirable? My own feeling is that the perl version is best - if you want a fill say so, otherwise you don't get one.

Rick

Posted: 2006-12-23T13:02:55-07:00
by magick
Setting fill to opaque by default from the command line is a convenience so commands like:
  • convert label:Magick label.png
produce reasonable results. You can of course override the default with the -fill option:
  • convert -size 150x100 xc:white -fill none -stroke red -strokewidth 4 -draw "polygon 20,20 130,20 130,80" filltest-cmd.png
We do not do this with PerlMagick (or other API's) because program development assumes a greater skill than command line scripting.