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
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