Custom shapes cropping
Custom shapes cropping
Filters and effects
Creative
Layers
Intermediate

You can crop an image based on any custom shape. Do this by having your own custom image as a mask for cropping, setting the overlay parameter as your mask image's public ID and setting the flags parameter to cutter (in URLs: l_<mask_image>,fl_cutter).

Here's the original image: Original

https://res.cloudinary.com/demo/image/upload/pasta.jpg

The following PNG image was uploaded to Cloudinary with the 'hexagon_sample' public ID: Original

https://res.cloudinary.com/demo/image/upload/hexagon_sample.png

Now, you can use this image with the cutter flag. For example, when applying it to an image with the 'pasta' public ID: Custom shaped

https://res.cloudinary.com/demo/image/upload/w_173,h_200,c_fill/l_hexagon_sample,fl_cutter/pasta.png

You can also add the relative flag to automatically adjust the dimensions of the mask to match the resulting image you need. For example: Adjustable size

https://res.cloudinary.com/demo/image/upload/l_hexagon_sample,fl_cutter.relative,w_1.0,h_1.0/pasta.png

The mask image can also be a semi-transparent PNG file to make the edges smoother. Here's an example of an uploaded mask: Semi-transparent mask

https://res.cloudinary.com/demo/image/upload/hexagon_feather_sample.png

And here's a sample result while creating a 200x220 face detection based thumbnail of an uploaded image: Semi-transparency

https://res.cloudinary.com/demo/image/upload/w_200,h_220,c_thumb,g_face/l_hexagon_feather_sample,fl_cutter/face_left.png