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.
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
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)