Image Magick – 圆形裁剪命令现在失败

huangapple go评论53阅读模式
英文:

Image Magick - Circle Cropping command now failing

问题

这个主题之前已经有一些深入的讨论,但在Windows的V5和V7之间,其中一种推荐的方法似乎已经停止工作。

在Windows中,magick V7中不起作用。

错误是:'gray' 不被识别为内部或外部命令、可执行程序或批处理文件。

请有人告诉我在V7中使用这种方法的正确语法是什么? 谢谢

英文:

I know this topic has been covered in some depth previously, but one of the recommended methods seems to have stopped working between v5 and V7 in Windows.

magick input.jpg ( +clone -threshold 101% -fill white -draw "circle %[fx:int(w/2)],%[fx:int(h/2)] %[fx:int(w/2)],%[fx:int(h)]" ) -channel-fx "| gray=>alpha" output.png

Not working in Windows, magick V7.

error is that:-
'gray' is not recognized as an internal or external command,
operable program or batch file.

Would someone let me know what the correct syntax is for this method in V7 please?
Thanks

答案1

得分: 1

你的指令在我的Imagemagick 7.1.1.6 Mac OSX Monterey上运行正常。

英文:

Your command works fine for me in Imagemagick 7.1.1.6 Mac OSX Monterey.

magick lena.jpg \( +clone -threshold 101% -fill white -draw "circle %[fx:int(w/2)],%[fx:int(h/2)] %[fx:int(w/2)],%[fx:int(h)]" \) -channel-fx "| gray=>alpha" output.png

Image Magick – 圆形裁剪命令现在失败

If you are running that in a .bat file, you need to double your % to %%.

ADDITION

The circle works by specifying a center point and then some other point on the circumference. In the above, the center is specified and then a point at the same x value, but the y value is at the bottom of the image.

Another way to do it is to translate the origin from the top left to the center of the image and then draw from the new origin (center) to any point, for example the right side of the image (which is half of the width from the center to the side).

magick lena.jpg \( +clone -threshold 101% -fill white -draw "translate %[fx:int(w/2)],%[fx:int(h/2)] circle 0,0 %[fx:int(w/2)],0" \) -channel-fx "| gray=>alpha" output.png

Image Magick – 圆形裁剪命令现在失败

huangapple
  • 本文由 发表于 2023年4月17日 21:40:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76035799.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定