php imagick圆角
$watermark = new \Imagick(); $watermark->readImage($avatarpath); $watermark->scaleImage(160, 160, true); $watermark->setFormat('png'); $mask = new \Imagick(); $mask->newImage($watermark->getImageWidth(), $watermark->getImageHeight(), 'none'); $draw = new \ImagickDraw(); $draw->setFillColor('white'); $draw->roundRectangle(0, 0, $watermark->getImageWidth() - 1, $watermark->getImageHeight() - 1, $watermark->getImageWidth() / 2, $watermark->getImageHeight() / 2); $mask->drawImage($draw); $watermark->setImageMatte(1); // Apply the mask to the original image $watermark->compositeImage($mask, \imagick::COMPOSITE_DSTIN, 0, 0);
如果遇到什么不懂的地方直接关注公众号留言(本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。)
作者:newmiracle
出处:https://www.cnblogs.com/newmiracle/