Re: [GD-DEVEL] Drawing anti-aliased text with transparent background

From: Date: Sat, 17 Mar 2007 16:51:41 +0000
Subject: Re: [GD-DEVEL] Drawing anti-aliased text with transparent background
References: 1 2  Groups: php.gd.devel 
Request: Send a blank email to php-gd-devel+get-132@lists.php.net to get a copy of this message
Pierre, I need to create a png image with a transparent background so that when I put this image on top of any other image of _any_ color only the text will show. The text outline should look smooth without any fringes. I know when I create a transparent PNG in any graphic program like Photoshop I don't have to pick an anti-aliased color. AFIK, only gif needs a particular color for anti-aliasing. Could you please, enlighten me what we are missing in GD (how it works) and if I can get the result that we are talking about? Many thanks! Andrew On 3/17/07, Pierre <pierre.php@gmail.com> wrote:
On 3/17/07, Andrei Stebakov <lispercat@gmail.com> wrote: Gives me this resut: http://www.greenpixeldesign.com/cphandler/tmp-img/test.png I am using libgd 2.0.33 on debian, so basically I just create an image from scratch, set transparent color to black and use gdImageStringFT to draw to text. (I use lisp bindings to do that). What am I missing to remove the black outline from the text? The antialiasing is not 100% black, it does not match the transparent color (or index). That's why they remain and appears ugly in anything but a black background. If you want a white background, I suggest to use it in your image as transparent color. 2.1.0 will support antialiasing using the alpha channel only when the covered area is transparent. It will solve the problem as long as your browser supports transparency/opacity in the png image (IE does not). --Pierre


« previous php.gd.devel (#132) next »