1

When a user upload an avatar for himself, I want to convert it into a circular image and then save it, as circular looks much more prettier when displaying in the page.

How can I do that in a simple way, as mine is a small application. I have read about ImageMagick, but thats an option right now.

I read about masking or using another image as mask to do that.

Any simple method or way to do this. Thanxx in advance!!!

Milan Kumar
  • 77
  • 1
  • 6
  • 2
    there is no need to convert anything, just use pure CSS to make it circle: http://www.abeautifulsite.net/how-to-make-rounded-images-with-css/ – mitkosoft Mar 23 '16 at 07:30
  • you can save image as default and then display it in circular using border-radius: 50%; in CSS of your HTML tag. – Divyesh Jesadiya Mar 23 '16 at 07:31

1 Answers1

1

The same as said before, the best option is store the image 'as is' and then apply rounded styles with css (this way you always have the original image).

But if it not work for you, you could use this: https://adamcod.es/2012/07/25/imagine-php-image-library.html && Crop image in circle (php)

Using imageMagik is this simple:

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

circularize an image with imagick

Community
  • 1
  • 1
JP. Aulet
  • 4,375
  • 4
  • 26
  • 39