Replace Image Color
Posted on Sunday, August 16, 2009 in PHP
$imgname = "img.gif";
$im = imagecreatefromgif ($imgname);
$index = imagecolorclosest ( $im, 2,2,254 ); // get White COlor
imagecolorset($im,$index,255,255,255); // SET NEW COLOR
$imgname2 = "result.gif";
imagegif($im, $imgname); // save image as gifimagedestroy($im);
echo("origin image: <img src="\"".$imgname."\" />");
echo("new image: <img src="\"".$imgname2."\" />");

Leave a Comment
You must be logged in to post a comment.