你好,我正在尝试组合两个透明的png-24图像,都是400宽,150高。
背景资料:"http://www.fenixflame.net/Background-Zanaris-24.png“
我想要覆盖的图片背景是:"http://www.fenixflame.net/Bandos-Slayer-24.png“
我尝试过用php叠加透明图片,但只覆盖了png-8格式的图片。无法使用png-8,因为图像无法正确渲染。
编辑:我尝试过的代码:
$image = imagecreatefrompng("http://www.fenixflame.net/Background-Zanaris-24.png");
$frame = imagecreatefrompng("http://www.fenixflame.net/Bandos-Slayer-24.png");
//
//imagealphablending($frame,true);
//
$insert_x = imagesx($frame);
$insert_y = imagesy($frame);
imagecopymerge($image,$frame,0,0,0,0,$insert_x,$insert_y,100);
//
//# Save the image to a file imagepng($image, '/path/to/save/image.png');
imagepng($image, "/home1/fenixfla/public_html/Images/Signatures/NewImageBG.png");
//
//# Output straight to the browser.
imagepng($image);
//发布于 2010-12-23 07:04:03
使用GD库渲染图像并将其输出到php中。http://www.php.net/manual/en/ref.image.php
在那之后,它变得非常毛发。你必须使用start来做像这样的事情
imagealphablending($image, false);
imagesavealpha($image, true);以此类推,以确保透明度是正确的。
你可以在他们的首页here上看到我为客户所做的一个例子。这非常单调乏味,也是一个巨大的痛苦。玩得开心
发布于 2010-12-23 07:09:28
使用lib ImageMagick复合(http://www.imagemagick.org/script/composite.php)怎么样?
function composite() {
$command = "/usr/local/bin/composite [... your properties...]";
exec($command, $output, $result);
return ($result == 0 && $output[0] == "");
}发布于 2010-12-23 07:02:08
您可能希望查看以下内容:http://php.net/manual/en/function.imagecopymerge.php
imagecopymerge函数是PHP GD库的一部分。
https://stackoverflow.com/questions/4514488
复制相似问题