简体   繁体   English

php imagick图像圆角黑色背景

[英]php imagick image rounded corners black background

        $image = new Imagick($destinationPath.'/'.$filename);
        $image->roundCorners(1575,1575);

I'am uploading different images, one image background is transparent when I make corners rounded, but the other image background is black, why is that? 我要上传不同的图像,当我将圆角弄圆时,一个图像背景是透明的,但是另一个图像背景是黑色的,为什么? and from what is depending this behaviour? 从什么方面取决于这种行为?

I've tried to do this: 我试图做到这一点:

$img->setBackgroundColor(new ImagickPixel('transparent'));

but the background is still black, someone knows which method can handle this? 但是背景仍然是黑色的,有人知道哪种方法可以处理吗?

如果源图像是JPEG,则需要将最终图像格式设置为PNG,因为JPEG不处理透明度。

$img->setImageFormat('png');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM