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

[email protected] (Pierre)
Newsgroups php.gd.devel
Message-ID <[email protected]>
On 3/17/07, Andrei Stebakov <[email protected]> wrote:
> Sorry if I might appear repeating myself, but I need to make myself clear.
> My goal is to create a .png image that has some text on a transparent
> background. I need that image to look equally good placed on top of any
> other image regardless of its color or transparency. I can easily create
> such .png images with Gimp or Photoshop. So I wonder if it can be done with
> the library.

Here you go:

Result:
http://blog.thepimp.net/public/images/gd/ttf/text_on_transparent_bgd.png

and the code:
http://cvs.php.net/viewvc.cgi/gd/playground/text_on_transparent_background/text_aa_alpha.c?revision=1.2&view=markup

Please remember that it will work for text but not other shapes. The
antialiased lines always blend on the destination pixel, for now.

--Pierre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.