Page 1 of 1

Antialias problem with Draw()

Posted: 2007-08-10T19:10:38-07:00
by erinspice
Hi! I have a script with the following lines of code:

Code: Select all

$color = "#ff0000";

my $x = $image->Draw(fill=>'#000000',primitive=>'rectangle',points=>"0,0 $width,$height",antialias=>0);
$x && warn $x;

$x = $image->Draw(fill=>'#ffffff',primitive=>'rectangle',points=>"1,$whitestart $greywidth, $greyheight", antialias=>0);
$x && warn $x;

$greyheight -= $barheight;
$x = $image->Draw(fill=>'#eeeeee', primitive=>'rectangle',points=>"1,1 $greywidth,$barheight",antialias=>0);
$x && warn $x;

$x = $image->Draw(fill=>$color, primitive=>'rectangle',points=>"1,1 $barwidth,$barheight",antialias=>0);
$x && warn $x;
My problem is that fourth and last [red] rectangle that is coming out antialiased with lots of shading on the edges, which isn't what I want. I can only think of 2 differences between the fourth call to Draw() and the first three: the fourth one uses a user-specified color and also, it draws on top of 2 other rectangles, where the others draw on 0 and 1 rectangle, respectively. Any suggestions?

Image

Re: Antialias problem with Draw()

Posted: 2007-08-12T21:03:52-07:00
by erinspice
Wow, this forum isn't very active, is it. :( Anyway, I figured the problem out. It wasn't an antialiasing problem. The JPEG compression was causing the artifacts. I started saving the files as GIFs and the problem was fixed.

Re: Antialias problem with Draw()

Posted: 2007-10-03T03:40:29-07:00
by anthony
GIF may not have edging artifacts but if the number of colors in the image exceeds 256 you will get color reduction happening. Use PNG, or for intermedte processing image use MIFF or even .miff.gz (gziped miff).