Welcome folks today in this blog post we will be using the rembg
library to remove the background
from the image in python. All the full source code of the application is shown below.
Get Started
In order to get started you need to install the below library
using the pip command as shown below
pip install rembg
And after that you need to make an app.py
file and copy paste the following code
app.py
1 2 3 4 5 6 7 8 9 10 |
from rembg import remove input_path = '##inputimagepath##.jpg' output_path = '##outputimagepath##.jpg' with open(input_path, 'rb') as i: with open(output_path, 'wb') as o: input = i.read() output = remove(input) o.write(output) |