The Little Guy Posted March 24, 2012 Share Posted March 24, 2012 I have 2 GD images, one is a JPG, the other is a gd created image. <?php header("content-type: image/png"); $img = imagecreatefromjpeg("./real/soldier.jpg"); $img2 = imagecreatetruecolor(300, 300); imagesavealpha($img2, true); $color = imagecolorallocatealpha($img2, 255, 0, 0, 75); imagefill($img2, 0, 0, $color); $final = imagecreatetruecolor(300, 300); imagecopymerge($final, $img, 0, 0, 0, 0, 300, 300, 100); imagecopymerge($final, $img2, 0, 0, 0, 0, 300, 300, 100); imagepng($final, null, 9); I am trying to place the gd created image (Red image) on top of the other (soldier.jpg), but for some reason I can not figure out why the red is a solid red when I told it to have transparency to it (75). So basically how do I create images like this with saved alpha? Quote Link to comment https://forums.phpfreaks.com/topic/259651-merge-2-gd-images-with-alpha/ Share on other sites More sharing options...
The Little Guy Posted March 24, 2012 Author Share Posted March 24, 2012 Why is it I always figure it out almost instantly after I post? imagecopy not imagecopymerge Quote Link to comment https://forums.phpfreaks.com/topic/259651-merge-2-gd-images-with-alpha/#findComment-1330803 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.