Reputation: 9
$tileImg = imagecreatefrompng($srcImagePath);
imagealphablending($tileImg,true);
imagecolortransparent($tileImg, imagecolorallocatealpha($tileImg, 255, 255, 255, 0));
imagecopymerge($mapImage, $tileImg, $x, $y,0, 0, $tileWidth, $tileHeight,100);
imagedestroy($tileImg);
$bgColor = imagecolorallocate($mapImage, 255, 255, 255);
imagefill($mapImage, 0, 0, $bgColor);
I am trying to get transparent image with but somehow the background come up in black color...
Please help.
Upvotes: 0
Views: 386
Reputation: 4145
It's bit of time that I don't play GD, but if you say that the transparent is white #FFFFFF you can't use as normal (background) color.
ADD
a quick solution can be set the transparent as FFFFFE or FEFFFF or FFFEFF, avoiding to "use" white as transparent
Upvotes: 1