imagefill() turns rest of the area black

Posted by Nidhinzz Own on Stack Overflow See other posts from Stack Overflow or by Nidhinzz Own
Published on 2012-11-19T16:48:59Z Indexed on 2012/11/19 17:00 UTC
Read the original article Hit count: 154

Filed under:
|

I'm using imagefill() for changing the background color if an image.But while doing so the other areas which are not to be affected, change its color to black.

$image = imagecreatefrompng("sample.png");
$background = imagecolorallocate($image, 255, 0,0);
imagefill($image, 0,0, $background);
header("content-type: image/png");
imagepng($image,"sample.png");

This is my code.Can anyone tell me how this is happening ?

© Stack Overflow or respective owner

Related posts about php

Related posts about image