Apply the trim
filter to remove the edges around the image. Do this by setting the effect
parameter to trim
(e_trim
in URLs). You can customize the color similarity tolerance between 0
and 100. The default level is
10`.
Here's an example image:
By enabling the trim
effect, we tell Cloudinary to detect and remove image edges whose color is similar to corner pixels:
We can customize the color tolerance level to be returned with various results. For example, raising the custom value to 50
:
The trim
effect works on any color. In addition, you can add parameters to the trim
effect to control the tolerance for similar coloring. For example, here's an image in which the default trimming level isn't enough:
Since the default level is 10
, we probably need to raise the tolerance a bit. If we try this again with a higher value (e.g., 20
), this seems to deliver the result we need: