You can use your own custom image as a mask for cropping by adding an overlay and using the 'cutter' transformation flag.
Using the API (in Ruby):
:overlay => "my_shape", :flags => "cutter".
For example, the following PNG image was uploaded to Cloudinary with the 'hexagon_sample' public ID.
Now you can use this image with the
cutter flag. For example, applying on an image with the 'sample' public ID:
You can also add the
relative flag to automatically adjust the dimensions of the mask to match the resulting image you need. For example:
The mask image can be a semi-transparent PNG file to make the edges more smooth.
Here's such an uploaded mask:
And here's a sample result while creating a 200x220 face detection based thumbnail of an uploaded images:
Following this example I get hexagonal image with a white background instead of a transparent one. I have uploaded the same image you provide here as a mask.
Hi Daniel, can you please share a URL example which demonstrates the issue? if you rather keep it private, please feel free to open a support ticket with all the necessary information.
Please sign in to leave a comment.