imagettftext color problem / GD Bug on animated gif

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
bookerb
Forum Newbie
Posts: 2
Joined: Thu Sep 21, 2006 1:13 pm

imagettftext color problem / GD Bug on animated gif

Post by bookerb »

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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:3. Do not make multiple, identical posts. This is viewed as spam and will be deleted.
bookerb
Forum Newbie
Posts: 2
Joined: Thu Sep 21, 2006 1:13 pm

Post by bookerb »

Yes, sorry, I hadn't realized that there were 2 areas under DevNetwork Forums, one specifically for GD. I will remove my post from general php now.

Regards,
Booker Bennett
Post Reply