带有剪切路径的 imagemagick 锯齿边缘

Posted

技术标签:

【中文标题】带有剪切路径的 imagemagick 锯齿边缘【英文标题】:imagemagick jaggy edges with clipping path 【发布时间】:2016-09-23 20:27:31 【问题描述】:

我们更新到最新版本的 ImageMagick (ImageMagick-7.0.3-1-Q16-x64-dll),从那时起,所有具有剪切路径的图像都是锯齿状的。我一生都无法弄清楚为什么。我不记得我们之前使用过的旧版本,但是当它们被剪裁时,图像在白色背景上都有平滑的边缘。这是我正在使用的脚本示例:

convert -density 400x400 \
-profile "C:\Step_Assets\Profile\sRGB_profile.icc"  \
"C:\Users\programmer\Desktop\Testing Imagemagick\original\852067A.tif" \
-flatten  \
-alpha transparent \
-clip-path "silo" \
-alpha opaque -trim -density 72x72 -strip -resize 600x600 \
-gravity center -extent 600x600 +repage -quality 96 \
"C:\Users\programmer\Desktop\Testing Imagemagick\converted\852067A_d.jpg"

这是一个精简版的脚本,可生成 4 张不同尺寸的图片。

这是一个通过 imagemagick 运行并被剪辑的图像示例:

任何帮助表示赞赏!!!

【问题讨论】:

您之前使用的版本是什么?你能展示一下它当时的样子吗? 以前的版本是 ImageMagick-6.9.2-3-Q16-x86-dll。 !Conversion of old image vs conversion of new image. 【参考方案1】:

解决了!

通过在 -strip 选项之前添加 +clip 我能够解决它。

转换-密度 400x400 \ -profile "C:\Step_Assets\Profile\sRGB_profile.icc" \ "C:\Users\programmer\Desktop\Testing Imagemagick\original\852067A.tif" \ -展平\ -阿尔法透明\ -剪辑路径“筒仓”\ -alpha opaque -trim -density 72x72 +clip -strip...

【讨论】:

以上是关于带有剪切路径的 imagemagick 锯齿边缘的主要内容,如果未能解决你的问题,请参考以下文章

CGContextClip 抗锯齿问题

photoshop作的图片怎么去掉边缘锯齿

求助 解决png图片 锯齿边缘 的优化

绘制剪切图像时可以进行抗锯齿处理吗?

使用 imagemagick 将剪切/裁剪标记添加到 pdf

imagemagick 图片处理相关问题?