rembg is a python library which utilizes Neural Network AI models and ONNX to remove the backgrounds from supplied image files. Can be used as a library or a CLI tool.

#image-processing #background-removal #python #library #ai #neuralnet #machine-learning #ml

Daniel Gatis 7fb6683169 initial 5 jaren geleden
examples 7fb6683169 initial 5 jaren geleden
src 7fb6683169 initial 5 jaren geleden
.editorconfig 7fb6683169 initial 5 jaren geleden
.gitignore 7fb6683169 initial 5 jaren geleden
LICENSE.txt 7fb6683169 initial 5 jaren geleden
MANIFEST.in 7fb6683169 initial 5 jaren geleden
README.md 7fb6683169 initial 5 jaren geleden
pyproject.toml 7fb6683169 initial 5 jaren geleden
requirements.txt 7fb6683169 initial 5 jaren geleden
setup.cfg 7fb6683169 initial 5 jaren geleden
setup.py 7fb6683169 initial 5 jaren geleden

README.md

Rembg

Rembg is a tool to remove images background. That is it.

Installation

Install it from pypi

    pip install rembg

Usage as a cli

Remove the backaground from a remote image

    curl -s http://input.png | rembg > output.png

Remove the backaground from a local file

    rembg -o path/to/output.png paht/to/input.png

Remove the backaground from all images in a folder

    rembg -p path/to/inputs

Usage as a server

Start the server

    rembg-server

Open your browser to

    http://localhost:5000?url=http://image.png

Usage as a library

In app.py

import sys
from rembg.bg import remove

sys.stdout.buffer.write(remove(sys.stdin.buffer.read()))

Then run

    cat input.png | python app.py > out.png

References

License

Copyright (c) 2020-present Daniel Gatis

Licensed under MIT License