Imagick PHP扩展-蒙太奇帮助吗? [英] Imagick PHP Extension -- Montage help?
本文介绍了Imagick PHP扩展-蒙太奇帮助吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Imagick PHP扩展名生成图像时遇到了一些麻烦.一切正常,除了我后面的蒙太奇"具有白色背景,因此我无法将其覆盖在其他东西之上.如何生成具有透明背景的蒙太奇?
I've been having some trouble generating an image with the Imagick PHP extension. Everything works fine, except my following "montage" has a white background and therefore I cannot overlay it on top of something else. How can I generate a montage with a transparent background?
$Montage = $Icons->montageImage(new imagickdraw(), "3x2+0+0", "34x34+3+3", imagick::MONTAGEMODE_UNFRAME, "0x0+0+0");
$Canvas->compositeImage($Montage, $Montage->getImageCompose(), 5, 5);
谢谢!
推荐答案
我遇到了同样的问题,发现imagick的MagickWand C API不支持蒙太奇选项.
I had the same problem and discovered that the MagickWand C API, which powers imagick), doesn't support the option for montage.
我最终像这样手动对其进行剪辑:
I ended up montaging it manually like this:
// Add them to an array of Imagick objects, instead of using addImage().
$images = new Array();
// Make a transparent canvas.
$target = new Imagick();
$target->newImage($width, $height * count(images), 'none');
$i = 0;
foreach ($images as $image) {
$target->compositeImage($image, imagick::COMPOSITE_COPY, 0, $height * $i++);
}
这篇关于Imagick PHP扩展-蒙太奇帮助吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文