Search code examples
phpgdimagemagick

Crop or mask an image into a circle


What is the best way to crop or mask an image into a circular shape, using either ImageMagick or GD libraries? (Note, solution exists on "other" Q&A sites, but not StackOverflow)


Solution

  • Here is one way with ImageMagick that will acomplish this without using a mask:

    convert -size 200x200 xc:none -fill walter.jpg -draw "circle 100,100 100,1" circle_thumb.png
    

    walter alt text