|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30229 (imagerectangle + alpha level > 0) = color bug
Submitted: 2004-09-25 15:21 UTC Modified: 2004-11-21 19:14 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: a25617 at alunos dot det dot ua dot pt Assigned: pajoye
Status: Closed Package: GD related
PHP Version: Irrelevant OS: Windows XP
Private report: No CVE-ID:
 [2004-09-25 15:21 UTC] a25617 at alunos dot det dot ua dot pt
When using a transparency level above zero, drawing a rectangle will produce 4 dots in the corners. I think this is because the 4 lines of the rectangle are drawn and the corners will be overridden 2 times making the color on the corners darker than the rest.

Reproduce code:
  $im = imagecreatetruecolor(100, 100);
  $bg = imagecolorallocate($im, 250, 250, 250);
  $blue = imagecolorallocatealpha($im, 150, 150, 255, 60);
  imagefilledrectangle($im, 0, 0, 100, 100, $bg);
  imagerectangle($im, 20, 20, 80, 80, $blue);

Expected result:
And grayed backgrounded image 100x100 with a blue rectangle 60x60 in the middle.

Actual result:
Everything is ok except the corners of the rectangle are darker. In some complex examples like drawing gantt or bar charts that bug stands out even more.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-17 21:13 UTC]
Got the fix, will commit asap.

 [2004-11-20 14:35 UTC]
Please try using this CVS snapshot:
For Windows:

Commited to 4.3

 [2004-11-20 14:50 UTC] a25617 at alunos dot det dot ua dot pt
 [2004-11-21 17:32 UTC]
Does it work now?
 [2004-11-21 18:51 UTC] a25617 at alunos dot det dot ua dot pt
Yes, that version looks like it's working. Thank you :)
 [2004-11-21 19:14 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 22:01:36 2015 UTC