Anton Posted February 19, 2012 Share Posted February 19, 2012 I am trying to copy an image into another image. $im = imagecreatefrompng("/oldimg.png"); //this is a semi-transparent image where I want the new image to be copied imagealphablending($im, 1); //this seems to remove the black background header('Content-type: image/png'); //outputs old image with a transparent background (YAY!) imagepng($im); imagecopy($im, $newimage, 32, 0, 0, 0, 32, 32); //I want to replace a part of the old image with a new semi-transparent image header('Content-type: image/png'); //outputs image with a black background (noooooooooo!) imagepng($im); Can anyone help me? Quote Link to comment Share on other sites More sharing options...
kicken Posted February 20, 2012 Share Posted February 20, 2012 Use the function imagesavealpha to tell GD to save complete alpha channel information to the image. Otherwise it only does single-color transparency such as what GIFs use. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.