imagecolorset
Posted: Wed Feb 18, 2009 5:54 am
Hi,
Can anyone see what is wring with this code?
Header("Content-type: image/jpg");
$imgname = "sketch.jpg";
$im = imagecreatefromjpeg($imgname);
$index = imagecolorclosest($im, 0,0,0); // get black
imagecolorset($im,$index,255,255,255); // set to white
imagepng($im);
imagedestroy($im);
I'm expecting the black color in the image to be replaced by white. All I get is the same image (looking un-edited). Any ideas?
Can anyone see what is wring with this code?
Header("Content-type: image/jpg");
$imgname = "sketch.jpg";
$im = imagecreatefromjpeg($imgname);
$index = imagecolorclosest($im, 0,0,0); // get black
imagecolorset($im,$index,255,255,255); // set to white
imagepng($im);
imagedestroy($im);
I'm expecting the black color in the image to be replaced by white. All I get is the same image (looking un-edited). Any ideas?