英文:
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
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论