|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34357 BG alpha value isnt counted for when drawing antialias lines on transparent pics
Submitted: 2005-09-03 11:50 UTC Modified: 2005-09-04 03:30 UTC
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: zakay at danial dot se Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.0.4 OS: Gentoo Linux, OS X, Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
31 + 48 = ?
Subscribe to this entry?

 [2005-09-03 11:50 UTC] zakay at danial dot se
When drawing antialias lines on semi or fully transparent 
pictures the alpha value on the bg isn't accounted for.
And the color blending isn't working correctly.

Reproduce code:

Expected result:
White antialias lines on fully transparent png created by GD.

Actual result:
White lines that have the antialias colored as fully white or 
a bit black.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-03 12:59 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Your background is white, whether it is full transparent or not is not really relevant.

White on white does not use any blending method.
 [2005-09-03 14:14 UTC] zakay at danial dot se
Have you even seen the link I posted?
Really do check the link and then tell me its not a bug.
And please this is a very easy code, give me the solution 

I opened the source code for that part, and I say the BLEND 
function, and it doesn't do alpha blending correctly.

See the link, please.
 [2005-09-03 14:21 UTC] zakay at danial dot se
I don't want it to blend the color, but imageline with 
antialias enabled thinks that the background is none-
transparent and thus the result.. no smooth line.. but a 
thicker line where instead it would be antialiased.
 [2005-09-03 14:35 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Please read my answer and how works antiaalising in general.

You have a _transparent color, and this color is white. Your draw a white line, what do you expect? Or should I automagically know the color used when you display the images? (in your case the grey of your page).

Or what do you consider as correct blending method in this case?

 [2005-09-03 14:51 UTC] zakay at danial dot se
Ok, I made a picture in photoshop, a png with white lines 
antialiased.. and a brush thats blury.
Please notice that it doesn't matter what the background 
color is. .I use the same picture on three different 
background colors in the html.

Can you make lines in PHP-GD that works the same way?

Its seems no, cause actually you haven't thought about this 

I don't want it to know what background color I use in my 
HTML, I want it to think that the image I work on is 
transparent and the antialiased lines work on whatever 
background I choose to.

Please see my second link:
 [2005-09-03 15:11 UTC]
Little explanation.

Antialiasing here works with in direct rendering mode, using some blending operations.

What you did in photoshop is to set the alpha channel. The channel being kept in the final image.

Both being two completelly different things and it is actually  not possible to create the later in GD.

See some introduction to graphics programming (GEMs, Black book, ...) to get more informations about this topic.

 [2005-09-03 16:56 UTC]
Reset the original category....
 [2005-09-03 19:11 UTC] zakay at danial dot se
I made my own patches to the sources.. and now I have it 
working.. My way..

Thanx anyway..
 [2005-09-04 03:30 UTC]
Good, it is not possible to switch to a alpha based anti aliasing now in GD, for many historical and boring reasons (like bc).

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 23:01:27 2024 UTC