note 32171 added to function.imagecolorallocate
| From: | BruceB at rack1 dot php dot net | Date: | Mon, 19 May 2003 14:39:59 +0000 |
| Subject: | note 32171 added to function.imagecolorallocate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48593@lists.php.net to get a copy of this message | ||
Doiveo's suggestion for getting the font colors to behave with JPEG's does (at least for
PHP 4.1.2 - GD version 1) stop the problem (that I had) with fonts becoming outlined instead of
solid, however the font colors were still incorrect.
There is however a much simpler (and faster) solution, just use imageColorClosest instead of
imageColorAllocate, e.g:
$near_white = imageColorClosest($img, 255,255,255);
imageTTFtext($img, 10, 0, 20, 20, $near_white, "font file path", "text to add to
JPEG");
For most JPEG's there should be a fairly close matching color to the one you want to use.
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorallocate.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32171
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32171&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32171&report=yes