note 32171 deleted from function.imagecolorallocate by danbrown
| From: | danbrown@php.net | Date: | Fri, 24 Apr 2009 12:52:37 +0000 |
| Subject: | note 32171 deleted from function.imagecolorallocate by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153675@lists.php.net to get a copy of this message | ||
Note Submitter: BruceB
----
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.