Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copying a transparent image over another transparent image

Im trying to copy a image(a.png) on another. Both contain transparency. a.png shows up with a white background on save.

$base=imagecreatefrompng("base.png");
imagealphablending( $base, false );
imagesavealpha( $base, true );
$temp=imagecreatefrompng('a.png');
imagecopymerge($base,$temp,64,144,0,0,16,16,100);
like image 337
GUIpsp Avatar asked Mar 22 '11 21:03

GUIpsp


1 Answers

Try this:

$base=imagecreatefrompng("base.png");
imagealphablending( $base, true );
imagesavealpha( $base, true );
$temp=imagecreatefrompng('a.png');
imagecopy($base,$temp,64,144,0,0,16,16);
like image 54
Mike C Avatar answered Sep 30 '22 11:09

Mike C