Remove the background from your picture using Python Library “rembg”

Gauri Guglani
Jul 15, 2023

--

Hello Readers & Techies, I am back with another of my learning sharing session. In this article I am using rembg(remove background) library by python to remove the background in my image.

It is very easy to use and understand and canbe helpful at times when you are in urgent need to removing backgrounds from your pictures.

Below I have mentioned the code -:

pip install rembg
from rembg import remove
from PIL import Image
input = ("/kaggle/input/picture/2.jpg")
output_path = ("/kaggle/input/picture/2.jpg")
inp = Image.open(input)
output = remove(inp)
output

In the above code my input was-

and the out which i receive was this-

This was a great transaformation in the picture and I am more impressed by watching how neatly it got converted.

Hope you will get to learn from this mini article/tutorial.

--

--

Gauri Guglani
Gauri Guglani

Written by Gauri Guglani

Data Science |Technology |Motivation | Reader | Writer | Foodie| YT- https://www.youtube.com/@GauriGuglani

No responses yet