0

I'm creating a website where user can edit images. For changing the colour of a png file, I use the following code.

$im = imagecreatefrompng ("image/white-round.png");
$index = imagecolorclosest ( $im,  255,255,255 ); 

imagecolorset($im,$index,0,0,255); 

$imgname = "image/white-round.png";

imagepng($im,$imgname );
imagedestroy($im);

I'm getting $index, but imagecolorset($im,$index,0,0,255); is not working.

4
  • 2
    "Not working" how? What happens?
    – Pekka
    Nov 3, 2012 at 11:25
  • Im not getting the result. And I just tried if(!imagecolorset($im,$index,0,0,255)){ echo "hii";exit; } and it enters inside the if condition.So I guess its not working.Is it due to any other factor ?
    – I'm nidhin
    Nov 3, 2012 at 11:57
  • 1
    What result are you getting? Use var_dump() to find out
    – Pekka
    Nov 3, 2012 at 12:21
  • nothing.it doesn't display anything.
    – I'm nidhin
    Nov 3, 2012 at 17:19

1 Answer 1

1

imagecolorset() doesn't work for me.

But imagefill() works fine for me.

Refer http://www.tuxradar.com/practicalphp/11/2/8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.