Merging 2 PNGs and keeping transparency

Hi All,

I haven’t done much with GD so any help appreciated.

I am creating one image out of two. One is a pretty picture, one is the frame. The frame is merged ontop of the pretty picture but the transparency is not coming through, any ideas?


$your_original_image = "img1.png";
$your_frame_image = "img2.png";

$image = imagecreatefrompng($your_original_image);
$frame = imagecreatefrompng($your_original_frame);

imagesavealpha($frame, true);

 imagecopymerge($image, $frame, 0, 0, 0, 0, 50, 50, 100);

header('Content-Type: image/png');

Thanks in advance,


Sorted it - got tired so left it. Woke up re-wrote from scrtahc and it fine - don’t ask me why? Tired eyes probably!