Transforming an image to a rounded version is simply done by using the radius
parameter (r
in URLs). It accepts the number of pixels of the radius of all four corners.
Many website designs call for images with rounded corners, while some websites require images with a complete circular or oval (ellipse) crop. Twitter, for example, uses rounded corners for its users' profile pictures. Having images with rounded corners is great if you want to simplify your CSS and markup or when you need to support older browsers. With Cloudinary, rounding the corners of the image can be easily done on-the-fly in the cloud.
Here's an original sample image:
https://res.cloudinary.com/demo/image/upload/front_face.jpg
Here's the same image with rounded corners of 30 pixels.
https://res.cloudinary.com/demo/image/upload/r_50/front_face.jpg
Note that the conversion to PNG is needed for supporting a transparent background:
https://res.cloudinary.com/demo/image/upload/r_50/front_face.png
Any other radius value is accepted of course, for example - '20':
https://res.cloudinary.com/demo/image/upload/r_20/front_face.png
You can apply rounded corners on any image, for example, here's how to round the corners of a Facebook Profile pictures fetched in real-time:
https://res.cloudinary.com/demo/image/facebook/r_50/billclinton.png
Cloudinary supports cropping images to a shape of an ellipse or a circle by passing max
as the value of the radius
parameter (r_max
in URLs).
The following example transforms an uploaded JPG to a 100x150 PNG with max radius cropping, which generates the ellipse shape based on the detected face, with a transparent background:
https://res.cloudinary.com/demo/image/upload/w_100,h_150,c_fill,g_face,r_max/front_face.png
Setting the width
and height
to the same value will generate a circle:
https://res.cloudinary.com/demo/image/upload/w_150,h_150,c_fill,g_face,r_max/front_face.png
Any further image transformations can be also applied.