note 18150 added to function.imagecolorallocate
| From: | doiveo at hotmail dot nospam | Date: | Sat, 12 Jan 2002 03:17:00 +0000 |
| Subject: | note 18150 added to function.imagecolorallocate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24728@lists.php.net to get a copy of this message | ||
This will help anyone trying to control font colors in a JPEG. You have to create a temporary image
first, allocate the colors then merge the images before it works. Go figure.
$im_size = GetImageSize ( "MySource.jpg" );
$imageWidth = $im_size[0];
$imageHeight = $im_size[1];
$im = imageCreate( $imagewidth, $imageheight );
// - or with GD 2+ -
// $im = imageCreateTrueColor( $imagewidth, $imageheight );
// do all your color allocations here
$font_color_black = ImageColorAllocate( $im, 0,0,0);
$im2 = ImageCreateFromJPEG("MySource.jpg");
ImageCopy ($im,$im2,0,0,0,0, $imageWidth, $imageHeight);
ImageDestroy ($im2);
...finish as you please using the $im var.
--
http://www.php.net/manual/en/function.imagecolorallocate.php
http://master.php.net/manage/user-notes.php?action=edit+18150
http://master.php.net/manage/user-notes.php?action=delete+18150
http://master.php.net/manage/user-notes.php?action=reject+18150