请问怎么用imagemagick库实现GD库中imagecopyresampled的功能?把两张图叠在一起,看英文文档快看吐了,求捷径,哪怕告诉一个方法名我自己去研究,多谢!
//打开文件$imgA = "phpcn_logo.gif";$imgB = "phpchina.gif";$sourceImg = imagecreatefromgif($imgA);$targetImg = imagecreatefromgif($imgB);//获取文件大小$sourceSize = getimagesize($imgA);$targetSize = getimagesize($imgB);//合并图片imagecopyresized($targetImg, $sourceImg, 0, 0, 0, 0, $targetSize[0], $targetSize[1], $sourceSize[0], $sourceSize[1]);//保存结果$r = imagegif($targetImg, "c.gif");if($r){ echo "成功";}else{ echo "失败";}
//打开文件$imgA = "phpcn_logo.gif";$imgB = "phpchina.gif";$sourceImg = imagecreatefromgif($imgA);$targetImg = imagecreatefromgif($imgB);//获取文件大小$sourceSize = getimagesize($imgA);$targetSize = getimagesize($imgB);//合并图片imagecopyresized($targetImg, $sourceImg, 0, 0, 0, 0, $targetSize[0], $targetSize[1], $sourceSize[0], $sourceSize[1]);//保存结果$r = imagegif($targetImg, "c.gif");if($r){ echo "成功";}else{ echo "失败";}不要GD库,这个我已经实现了,因为速度太慢,想换imagemagick
已经实现,文档看吐了,贴代码啥也不说了
$image = new Imagick('05.png');$imagepng = new Imagick('16.png');$imagepng->setImageFormat("png");$image->compositeImage($imagepng, $imagepng->getImageCompose(), 0, 0);$imagepng->destroy();header("Content-Type: image/png");echo $image;$image->destroy();
直接用imagick。
$cmd = sprintf("composite -gravity %s -geometry %s -dissolve %s '%s' %s %s", 'SouthEast', '+10+10', 100, '16.png', '05.png', '05.png'); exec($cmd);
直接用imagick。
$cmd = sprintf("composite -gravity %s -geometry %s -dissolve %s '%s' %s %s", 'SouthEast', '+10+10', 100, '16.png', '05.png', '05.png'); exec($cmd);