【发布时间】:2017-01-31 13:55:12
【问题描述】:
如何结合这些命令在 ImageMagick 中实现圆形裁剪?
所以这个命令有效:
convert -size 200x200 xc:none -fill samia.jpg -draw "circle 100,100 100,1" circle_thumb.png
上面将拍摄一张照片并从中进行圆形裁剪,但裁剪将基于图片的左上角而不是图片的中心。
此命令也适用于裁剪:
convert *.jpg -resize 200x200^ -gravity Center -crop 200x200+0+0 +repage out.png
上面将根据图像的中心对图像进行方形裁剪。
所以我想做的是结合这两个命令。
我的目标:
将图片作为输入并根据图片的中心而不是图片的左上角对其进行圆形裁剪的命令。
任何具有 IM 技能的人可以向老兄展示如何解决这个问题?
维萨
Ubuntu 15.10
更新:
我在下面尝试了 Mark Setchell 的解决方案,但收到以下错误消息:
axx@axx-VPCEA3S1E:~/Desktop/circular-crop$ magick samia.png \( +clone -threshold 101% -fill white -draw 'circle %[fx:int(w/2)],%[fx:int(h/2)] %[fx:int(w/2)],%[fx:80+int(h/2)]' \) -channel-fx '| gray=>alpha' circle.png
magick: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/509.
magick: no image to apply a property "%w" @ warning/property.c/GetMagickPropertyLetter/2561.
magick: unknown image property "%w" @ warning/property.c/InterpretImageProperties/3499.
magick: no image to apply a property "%h" @ warning/property.c/GetMagickPropertyLetter/2449.
magick: unknown image property "%h" @ warning/property.c/InterpretImageProperties/3499.
magick: no image to apply a property "%m" @ warning/property.c/GetMagickPropertyLetter/2480.
magick: unknown image property "%m" @ warning/property.c/InterpretImageProperties/3499.
axx@axx-VPCEA3S1E:~/Desktop/circular-crop$
【问题讨论】:
标签: imagemagick