Trim method
AnsweredIs there a way to apply a trim filter to remove image border (like trim method in ImageMagick http://www.imagemagick.org/Usage/crop/#trim)
Thanks
-
Thanks Itay, My Problem is that I have some photos with whitespace and some without.
What I'm trying to accomplish is that if a photo has whitespace then I want to trim the whitespace to 20px, but if the image does not currently have any whitespace then I dont want to add any additional whitespace. Is there anyway for me to accomplish that using cloudinary.
3 -
Is there a way to trim but leave some padding.
For example if an image has an extra 50px on each side. I would like to trim but leave 20px of space around the image.
1 -
I'm having the same problem. I'd like to trim out white space but make sure that it leaves at least a set number of pixels on each side of the object.
1 -
Hi Christopher,
Cloudinary supports trimming white space around images using the 'trim' effect (
e_trim
).Here's an image example:
http://res.cloudinary.com/demo/image/upload/w_200,h_200,c_crop,g_face/face_top.jpg
And here's the same image using the 'trim' effect:
http://res.cloudinary.com/demo/image/upload/w_200,h_200,c_crop,g_face/e_trim/face_top.jpg
0 -
Thanks!
Where is the documentation for e_trim, I can't find it?
Is it only for white color?
0 -
The 'trim' effect is a new feature that isn't documented yet, we're working hard on updating and improving our documentation.
The 'trim' effect will work on any color, it's using the background color of the corners of the image. In addition, you can add parameters to the 'trim' effect in order to control the tolerance for similar coloring (e.g.,
e_trim:40
).For example, here's an image:
http://res.cloudinary.com/demo/image/upload/face_left.jpg
Since the background isn't a solid color, the 'trim' effect won't make a difference:
http://res.cloudinary.com/demo/image/upload/e_trim/face_left.jpg
Setting the tolerance parameter to 20 (Default is 10) will make the difference:
http://res.cloudinary.com/demo/image/upload/e_trim:20/face_left.jpg
0 -
How can I use e_trim in the PHP and jQuery libraries?
0 -
Hi Dayson,
Here are sample codes to deliver an image using the
trim
effect:In PHP:
<?php echo cl_image_tag("sample.jpg", array("effect" => "trim")); ?>
In jQuery:
$.cloudinary.image("sample.jpg", { effect: "trim" });
0 -
Is it possible to give weights for top,bottom,left, right? Like e:trim:20:20:20:40
0 -
Thank you for your suggestion.
While this is on our road-map to support in the future, there's no ETA yet.
0 -
You can accomplish that by adding a white border to the image, for example:
For more information:
http://cloudinary.com/blog/adding_borders_to_images-1
Post is closed for comments.
Comments
11 comments