PHP png image compositing [duplicate]
Possible Duplicate:
How to merge transparent PNG with image using PHP?
I am completely lost here, so help would be greatly appreciated. I am new to PHP image manipulation.
I have two semi-transparent png files, and I would like to overlay one over the other and output the resulting png.
Thanks in advanced.
EDIT:
- GD, though I can change that if needed.
- So far I've hacked this together from what I could find on the internet. It does not wo开发者_StackOverflow中文版rk.
imagecopymerge would be the solution
header("Content-Type: image/png");
$overlay = imagecreatefrompng("overlay.png");
$overlay_width = imagesx($overlay);
$overlay_height = imagesy($overlay);
$im = imagecreatefrompng("firstimage.png");
$width = imagesx($im);
$height = imagesy($im);
$dest_x = 0;
$dest_y = 0;
imagecopymerge($im, $overlay, $dest_x, $dest_y, 0, 0, $overlay_width, $overlay_height, 100);
imagepng($im);
精彩评论