Edit report at https://bugs.php.net/bug.php?id=25678&edit=1

 ID:                 25678
 Comment by:         adolf at sharklasers dot com
 Reported by:        php-bugs at demark dot org
 Summary:            Issues with imageantialias and imagesetthickness
 Status:             Not a bug
 Type:               Bug
 Package:            GD related
 Operating System:   Redhat 7.3 (2.4.20-20.7)
 PHP Version:        4.3.3
 Block user comment: N
 Private report:     N

 New Comment:

After 10 years the problem still exists! :(
A quick workaround would be to draw a second line 1 pixel displaced to the 
original line. You have 2 lines but it looks like one line with 2 pixels 
thickness.


Previous Comments:
------------------------------------------------------------------------
[2003-09-28 18:57:35] php-bugs at demark dot org

Looks to be a bug in the GD library. I wrote a quick 
program in C to call GD directly and got the same 
results.

------------------------------------------------------------------------
[2003-09-27 07:58:20] php-bugs at demark dot org

Description:
------------
Neither imageantialias and imagesetthickness seem to work reliably.

The included code produces a significantly different image than one would 
expect.

Reproduce code:
---------------
<?php

        $im = imagecreatetruecolor(500,500);

        $col0 = imagecolorallocate($im,153,204,153);
        $col1 = imagecolorallocate($im,118,153,118);

        imagefilledrectangle($im,0,0,499,499,$col0);

        imageantialias($im,TRUE);
        imagesetthickness($im,5);

        imagepolygon($im,array(100,100,100,400,400,400,400,100),4,$col1);
        imagerectangle($im,150,150,350,350,$col1);
        imageline($im,200,200,200,300,$col1);
        imageline($im,200,300,300,300,$col1);
        imageline($im,300,300,300,200,$col1);
        imageline($im,300,200,200,200,$col1);
        imageellipse($im,250,250,400,400,$col1);

        header("Content-type: image/png");
        imagepng($im);

?>


Expected result:
----------------
This code should generate four figures on a 500 x 500 image. Each figure should 
be centered on the image.

Figure 1: Small square drawn via imageline
Figure 2: Medium square drawn via imagerectangle
Figure 3: Large square drawn via imagepolygon
Figure 4: Large circle drawn via imageellipse

All figures should be drawn with a 5 pixel thick line.
All figures should be antialiased.

Actual result:
--------------
As listed, the code generates a properly sized image, but none of the figures 
are antialiased and only the medium square is set to the proper thickness. All 
the other figures are drawn with a 1 pixel thick line.

This image is available at:
http://www.demark.org/phpgdbug/image.png

If I comment out the imageantialias line, no figures are antialiases (as 
expected), but only the squares are drawn with the proper thickness. Once 
again, the circle is drawn with a 1 pixel thick line.

This image is available at:
http://www.demark.org/phpgdbug/image-noaa.png




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=25678&edit=1

Reply via email to