Install Library
pypi
github
$ pip install git+https://github.com/krypton-byte/removebg
Library
from removebg import RemoveBg
rb=RemoveBg()
res=rb.upload('images.png')
res.save('saved.png')
Run server
$ python -m removebg -p 8000
Command Line
without session
$ python -m removebg --file=3.jpg --json 2>/dev/null
{
"url": "https://o.remove.bg/downloads/47b11d7f-3157-4dea-88ba-a47632c348a2/3-removebg-preview.png",
"filename": "3-removebg-preview.png",
"width": 500,
"height": 500,
"foreground_type": "product",
"rated": false
}
save session
$ python -m removebg --file=3.jpg --save-session=session --json 2>/dev/null
{
"url": "https://o.remove.bg/downloads/47b11d7f-3157-4dea-88ba-a47632c348a2/3-removebg-preview.png",
"filename": "3-removebg-preview.png",
"width": 500,
"height": 500,
"foreground_type": "product",
"rated": false
}
load session
$ python -m removebg --file=3.jpg --load-session=session --json 2>/dev/null
{
"url": "https://o.remove.bg/downloads/47b11d7f-3157-4dea-88ba-a47632c348a2/3-removebg-preview.png",
"filename": "3-removebg-preview.png",
"width": 500,
"height": 500,
"foreground_type": "product",
"rated": false
}
get histories removebg
$ python -m removebg --get-histories --json 2>/dev/null
[{
"url": "https://o.remove.bg/downloads/47b11d7f-3157-4dea-88ba-a47632c348a2/3-removebg-preview.png",
"filename": "3-removebg-preview.png",
"width": 500,
"height": 500,
"foreground_type": "product",
"rated": false
}]