Oct. 20, 2023, 6:30 a.m. | isolderea

DEV Community dev.to

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.

code image import install pip python save simple

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne