DEV Community

Cover image for Remove image background with python
isolderea
isolderea

Posted on

1

Remove image background with python

Remove image background with python with a few simple lines of code

pip install rembg

from rembg import remove
from PIL import Image

input_path ='first.jpg'
output_path = 'result.png'

input = Image.open(input_path)
output = remove ( input)
output.save(output_path)

Write in the comment your result.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more