2012-01-26 77 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