2012-01-26 78 views
2

我有一张424x318的图像,我“画了”一个圆圈,剩下的透明。然后我想拿走那个圈子并把它裁掉。我怎样才能做到这一点?ImageMagick Crop Circle from Circle?

我的函数(bash的变量都只是正常的东西,$ SCALEFILE是文件,$ NEWFILE是它并将其作为和$ SIZE仅仅是正常大小的字符串X0,Y0 X1,Y1)

convert -size 416x318 xc:none -fill $SCALEFILE -draw "circle $SIZE" $NEWFILE

ps。我的圈子尺寸改变了。

谢谢!

回答

1

您可以使用-crop WxH + X + Y + repage将其裁剪到圆上。

例如:

convert -size 300x300 xc:transparent -fill "image.png" -draw "circle 240,90 290,90" -crop 100x100+190+40 +repage circle1.png 
convert -size 300x300 xc:transparent -fill "image.png" -draw "circle 70,90 110,90" -crop 100x100+20+40 +repage circle2.png 

enter image description here