Page 1 of 1

cercle crop or masking through imaghmagick.......

Posted: 2007-12-28T06:17:13-07:00
by soumya007
Hello all,

I'm trying to crop an image using imagemagic and I have done it successfully in general way. But now i'm trying to crop or mask it in cercle shape. I have tried many things but didn't find any luck.

If you guyz have any idea then please help me out. This is very urgent for me.

Thanks in advance

Regards - Soumya

P.S: You can also write to me at soumyajit.soumya@gmail.com

Re: cercle crop or masking through imaghmagick.......

Posted: 2008-01-03T18:22:26-07:00
by anthony
To crop a circle you must create a circle mask, to make parts of your original image transparent.

See IM exmaples, Channels and Masking

Re: cercle crop or masking through imaghmagick.......

Posted: 2008-01-07T12:44:54-07:00
by Bonzo
One way I have done it:

Code: Select all

<?php
exec("convert -size 400x300 xc:white -fill orange -draw \"circle 200,150 200,3\" \\
-gaussian 1x1 -transparent orange mask.png");

exec("convert ../original_images/sunflower.jpg mask.png -composite round.jpg");

unlink( 'mask.png' );
?> 
http://www.rubblewebs.co.uk/imagemagick ... =round.jpg