note 13963 added to function.imagecolorset.php
| From: | olivier at moostik dot net | Date: | Wed, 11 Jul 2001 21:49:55 +0000 |
| Subject: | note 13963 added to function.imagecolorset.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15256@lists.php.net to get a copy of this message | ||
This function change colors of an image with ranges 0>100 for each primary color:
int ImageSelectiveColor (int im, int red, int green, int blue)
im is image pointer
red, green and blue are ranges 0->100
function ImageSelectiveColor($im,$red,$green,$blue)
{
for($i=0;$i<imagecolorstotal($im);$i++)
{
$col=ImageColorsForIndex($im,$i);
$red_set=$red/100*$col['red'];
$green_set=$green/100*$col['green'];
$blue_set=$blue/100*$col['blue'];
if($red_set>255)$red_set=255;
if($green_set>255)$green_set=255;
if($blue_set>255)$blue_set=255;
imagecolorset($im,$i,$red_set,$green_set,$blue_set);
}
return $im;
}
http://www.php.net/manual/fr/function.imagecolorset.php