imagick transparentPaintImage 不工作
imagick transparentPaintImage not working
我有一张图片:
我正在使用这个 PHP/imagick 代码:
$BackgroundColor = "rgb(255, 255, 203)";
$img = new Imagick();
$img->readImage("xxxxxx");
$img->setImageFormat('png');
$img->transparentPaintImage($BackgroundColor,0,10,false);
$img->writeImage("xxxxxxx");
生成的图像不会将黄色变为透明。
即图像如上图一样保持黄色。
如有任何建议,我们将不胜感激。
谢谢!
大卫
文档有点过时了。您需要根据 system/library 量子范围计算模糊百分比。
$BackgroundColor = "rgb(255, 255, 203)";
$img = new Imagick();
$img->readImage("xxxxxx");
$img->setImageFormat('png');
$fuzz = Imagick::getQuantum() * 0.1; // 10%
$img->transparentPaintImage($BackgroundColor,0,$fuzz,false);
$img->writeImage("xxxxxxx");
我有一张图片:
我正在使用这个 PHP/imagick 代码:
$BackgroundColor = "rgb(255, 255, 203)";
$img = new Imagick();
$img->readImage("xxxxxx");
$img->setImageFormat('png');
$img->transparentPaintImage($BackgroundColor,0,10,false);
$img->writeImage("xxxxxxx");
生成的图像不会将黄色变为透明。 即图像如上图一样保持黄色。
如有任何建议,我们将不胜感激。
谢谢!
大卫
文档有点过时了。您需要根据 system/library 量子范围计算模糊百分比。
$BackgroundColor = "rgb(255, 255, 203)";
$img = new Imagick();
$img->readImage("xxxxxx");
$img->setImageFormat('png');
$fuzz = Imagick::getQuantum() * 0.1; // 10%
$img->transparentPaintImage($BackgroundColor,0,$fuzz,false);
$img->writeImage("xxxxxxx");