Smart anti-aliasing
| From: | tedd | Date: | Sun, 12 Feb 2006 18:40:42 +0000 |
| Subject: | Smart anti-aliasing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230269@lists.php.net to get a copy of this message | ||
Hi:
I know how to create a watermark by simply imposing one image on another via imagecopy() or imagecopymerge().
However, is there a way to place a watermark on a image such that the watermark is actually anti-aliased against the background of the base image?
For example, please review:
http://xn--ovg.com/watermark2
The centered watermark is clearly problematic because it was originally generated with anti-aliasing ON over a white background -- and thus white pixels are shown mixed throughout.
I could turn off the original anti-aliasing in generating the original watermark, but then I get a jagged watermark that looks just about as bad.
So, what I am asking is there a way to place text on an existing image such that the anti-aliasing adjust (i.e., smart) to the background of the image?
One of the possible solutions I was thinking was to create an image and then draw text on top of it, via something like this:
<?php
Header ("Content-type: image/gif");
$im = imagecreate (150, 150);
$background = ImageColorAllocate ($im, 238, 238, 238);
$text_color = ImageColorAllocate ($im, 00, 51, 102);
ImageTTFText ($im, 20, 45, 30, 130, $text_color, "arial.ttf","copyright 2006");
ImageGif ($im);
ImageDestroy ($im);
?>
But, it's not an image that's imported and the background in only one color. So, is there a way to load an image and then draw smart anti-aliased text on top of it?
Many thanks to all who reply.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com/