seanmt Posted September 26, 2009 Share Posted September 26, 2009 Hi, I'm having a bit of trouble with PHP & GD. I want the background of the image to be transparent but when I create a new image using... $im = imagecreatefrompng("backgrounds/bg7.png"); The resulting image just ends up with horrible black colour around the edge of it (as seen in the attached image). The original image can be seen here. All help will be much appreciated. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/175653-solved-php-gd-image-transparency/ Share on other sites More sharing options...
seanmt Posted September 26, 2009 Author Share Posted September 26, 2009 Ah nevermind. I tried using imagesavealpha again but this time I used it correctly. Doh. $im = imagecreatefrompng("backgrounds/bg7.png"); // // misc operations on the image... // //JUST ADDED THESE 2 LINES TO MY CODE AND IT ALL WORKS FINE NOW imagealphablending($im, false); imagesavealpha($im, true); imagepng($im); Link to comment https://forums.phpfreaks.com/topic/175653-solved-php-gd-image-transparency/#findComment-925583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.