Converting an image to transparent
Posted: Tue Jan 16, 2007 5:52 pm
Hi,
I have an image with a black background that I'd like to have converted to transparent image with the black part being transparent.
That's the code I have so far. So basically I create the image, exact the black color using imagecolorallocate, and make the black part of the image transparent. It isn't working. What am I missing? I don't want to overlay it over any images right now. I'd like to have the image be transparent at all times. PNG format would be better.
I have an image with a black background that I'd like to have converted to transparent image with the black part being transparent.
Code: Select all
$srcimg= imagecreatefromjpeg($newname2);
$black = imagecolorallocate($srcimg, 0, 0, 0);
imagecolortransparent($srcimg, $black);