PHP + GD + PNG color table troubles

From: Date: Wed, 29 Nov 2000 17:19:36 +0000
Subject: PHP + GD + PNG color table troubles
Groups: php.dev php.general 
Request: Send a blank email to php-dev+get-39606@lists.php.net to get a copy of this message
Hi, i'm having trouble with my PHP script, that is supposed to open a template and print the selected text on the template using GD. the problem is that when i save my template .PNG as a RGB file (16 million colors), the colors get screwed up. playing around, I found that the colors are right when I save the PNG as "indexed color" (256-color). BUT, the text what is supposed to be written on the image, is not in the right color - looks like the ImageColorAllocate() function does not allocate a new color, but instead tries to find the closest in the existing ones (which, since the template is in quite different colors than the text, fails miserably). I added the text color to the palette in PhotoShop - then the text color was right, but the nearest colors (antialiasing) were still screwed up. tried exporting the template PNG in Adobe Photoshop and Macromedia Fireworks. no difference. has anyone experienced similar problems? the page source is basically: <? Header ("Content-type: image/png"); $img=@ImageCreateFromPNG("template.png"); $col=ImageColorAllocate($img,51,102,153); ImageTTFText ($img, 9, 0, 30, 20, $col, "hiloginbld.ttf", $txt); ImagePng($img); echo $img; ?> PS. I'm not on the list, so please CC: the reply to me. thanks. Rgds, Tfr --==< tfr@cafe.ee >==< http://tfr.cafe.ee/ >==< +372-50-17621 >==--

« previous php.dev (#39606) next »