imagettftext color problem / GD Bug on animated gif
Posted: Thu Sep 21, 2006 1:50 pm
Hi all - possible GD limitation here
I am using GD/PHP extensively in a new website. We are just finishing a new tool that allows a person to create an animated gif (using gifsicle to actually do the animation portion. This tool layers text lines onto a 64 or 128 color gif background and then I store each frame seperately. Finally I use gifsicle to combine the frames and then do a final cleanup. Note that the single image frame are wrong before they are sent to gifsicle.
The problem I have encountered is when I use certain fonts on certain backgrounds. We can recreate this by using a gif with a 128 color gradient and then apply a different colored text string with a drop shadow or outline onto it. The result is that either the current text string loses its' color or another text string on the same layer (generally a different color from the current text string) goes black. If I use a smaller font or different font the problem goes away.
I believe the problem is GD trying to handle the anti-aliasing of the text string against the gradient background and getting confused. As you can imagine, the code I am using is too large to post here. However, I have posted two generated gifs that show the results. Note that bad_banner.gif has a typewriter style text that changes color at the end and that 3rd line of text destroys both it's own color and the 2nd line of text color.
http://tequilabedspins.com/bad_banner.gif
http://tequilabedspins.com/good_banner.gif
Or to see them side by side
http://tequilabedspins.com/banner.html
Hopefully someone else has encountered this problem before. If anyone needs anymore info I will endeavour to provide it.
Cheers,
Booker
I am using GD/PHP extensively in a new website. We are just finishing a new tool that allows a person to create an animated gif (using gifsicle to actually do the animation portion. This tool layers text lines onto a 64 or 128 color gif background and then I store each frame seperately. Finally I use gifsicle to combine the frames and then do a final cleanup. Note that the single image frame are wrong before they are sent to gifsicle.
The problem I have encountered is when I use certain fonts on certain backgrounds. We can recreate this by using a gif with a 128 color gradient and then apply a different colored text string with a drop shadow or outline onto it. The result is that either the current text string loses its' color or another text string on the same layer (generally a different color from the current text string) goes black. If I use a smaller font or different font the problem goes away.
I believe the problem is GD trying to handle the anti-aliasing of the text string against the gradient background and getting confused. As you can imagine, the code I am using is too large to post here. However, I have posted two generated gifs that show the results. Note that bad_banner.gif has a typewriter style text that changes color at the end and that 3rd line of text destroys both it's own color and the 2nd line of text color.
http://tequilabedspins.com/bad_banner.gif
http://tequilabedspins.com/good_banner.gif
Or to see them side by side
http://tequilabedspins.com/banner.html
Hopefully someone else has encountered this problem before. If anyone needs anymore info I will endeavour to provide it.
Cheers,
Booker