Cloudinary supports removing the background from an image in more than one way, depending on the input image's complexity and characteristics.
- Background removal effect
- Make-transparent effect
- Cloudinary's AI Background Removal add-on
- Pixelz- Remove the Background add-on
Background removal effect
When an image consists of a uniformly colored background, it can be removed by applying the background removal effect (e_bgremoval in URLs). For example, taking the following image
https://res.cloudinary.com/demo/image/upload/docs/casual_yellow.png
and applying the background removal effect yields the following result. You can also specify the exact color you would like to remove as follows: bgremoval:rgb:ffff00
.
For image formats that do not support transparency, the removed background is filled with white color, unless specified otherwise using the background color parameter (i.e. b_rgb:00ffff
).
More information is available in our documentation on the background removal effect.
Make-transparent effect
If the background is not uniform, you can also try the e_make_transparent effect.
The effect defines the background as all pixels that resemble the pixels on the edges of the image or the color specified by the color qualifier (i.e co_rgb:ff00ff
).
The sensitivity can be further tuned by adding a value between 0 and 100.
More information is available in our documentation on the make_transparent effect.
Cloudinary's AI Background Removal add-on
While the above methods can be an excellent solution for simple patterns, more complex ones will require a highly advanced algorithm. Therefore, Cloudinary has developed a sophisticated deep-learning algorithm that accurately and precisely removes the background of almost any image in seconds. You could subscribe to this add-on from your account's add-on page.
All relevant documentation for this add-on can be found in the Cloudinary AI Background Removal add-on documentation.
Pixelz - Remove the Background add-on
For even more complex scenarios, where a human expert is required to remove interfering items from the frame, leaving only the main object in the image, one can use the 3rd party add-on 'Pixelz - Remove-The-Background'.
Note that this comes with additional costs.
More information is available in the documentation for the Pixelz add-on.
Comments
4 comments
Hi Itay,
I need the `e_make_transparent` to remove the white background for my image, this works fine, but for some reason it is changing the sizing. Any thoughts on how to fix this?
The params I am using are `c_fill,e_trim,e_make_transparent`. It worked fine with just the first two, but now the sizing is off.
~ Sam
Hi Sam,
Could you share a specific example where this is happening?
Note that you could open a request at support@cloudinary.com and we could take a closer look at your specific use case
Hello,
I'm using Cloudinary CLI (based on Python) to upload images via API to Cloudinary environment/folder.
Which parameter I should use for removing white-background from images and make them transparent? Only solution found in documentation passing parameter to the URL, but is there an option make transparent background during the upload via API?
Thank you.
Hi there,
Sure, you can go to the docs for every option listed above and see how to upload using the CLI, for example, in the Cloudinary's AI Background Removal add-on:
Docs can be found here.
Please sign in to leave a comment.