Php 通过使用Imagick检测对象边缘使图像背景透明?
我正在尝试使图像的背景透明Php 通过使用Imagick检测对象边缘使图像背景透明?,php,image-processing,transparency,imagick,Php,Image Processing,Transparency,Imagick,我正在尝试使图像的背景透明 $strInputFile = 'test.jpg'; $target = 'test_transparent.png'; $im = new Imagick($strInputFile); $im->paintTransparentImage($im->getImageBackgroundColor(), 0, 7000); $im->setImageFormat('png'); $im->writeImage($target); $im-&
$strInputFile = 'test.jpg';
$target = 'test_transparent.png';
$im = new Imagick($strInputFile);
$im->paintTransparentImage($im->getImageBackgroundColor(), 0, 7000);
$im->setImageFormat('png');
$im->writeImage($target);
$im->destroy();
这段代码对于少数图像效果很好。但是对于大多数图像,输出结果并不理想。想要的结果来自脚本 不需要的结果来自脚本
是否可以检测模型的边缘并在模型之前删除颜色?可能会重复显示您的起始图像!可能会重复显示您的起始图像!