Crop transparent PNGs to content
Hello,
We'd like to upload transparent PNGs, with actual content somewhere in the image, with large transparent padding.
Next, we'd like to crop the image, with an option which we couldn't find in docs: remove transparent areas. That is, give back the smallest rectangle image which fits content.
From the example attached, we'd like just the ribbon cropped back. Please advise.
Thanks
-
You can use the
trim
effect (e_trim
in URLs), for example:
Here's the original:http://res.cloudinary.com/<your_cloud_name>/image/upload/5_Free_Ribbon_Templates_3_zq8zjs.png
And here's the trimmed version:Please see the following for more information:
http://support.cloudinary.com/entries/24041113-trim-method0 -
Great, thanks!
0 -
One more question, Itay.
We'll be serving ALL our images trimmed this way. Is there a performance impact in making e_trim requests vs. plain image requests? (do you cache the trimmed version)
If it is, we could re-upload to cloudinary the e_trim version and serve that in future, though it would be better for us without having to do this.
Thanks!
0 -
Re-uploading the images isn't necessary, you can still have your original images stored in your account, but deliver derived trimmed versions of it.
Every new transformation will create an new transformed (derived) image. Derived images can also be generated eagerly ( http://cloudinary.com/documentation/upload_images#eager_transformations).
After generated, the transformed images are stored in your account. After their first public access, the transformed images are cached in the CDN for fast delivery.
You can also choose to apply the
trim
effect as an incoming transformation while uploading, this will trim the original before storing it in your account.0
Post is closed for comments.
Comments
4 comments