iRembg
MODIFIED VERSION OF REMBG FOR PERSONAL USE
Installation
Install it from pypi
pip install irembg
Usage as a cli
Remove the background from a remote image
curl -s http://input.png | rembg > output.png
Remove the background from a local file
rembg -o path/to/output.png path/to/input.png
Remove the background 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
Also you can send the file as a FormData (multipart/form-data):
<form action="http://localhost:5000" method="post" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit" value="upload"/>
</form>
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
Advance usage
Sometimes it is possible to achieve better results by turning on alpha matting. Example:
curl -s http://input.png | rembg -a -ae 15 > output.png
| Original | Without alpha matting | With alpha matting (-a -ae 15) |
References
- https://arxiv.org/pdf/2005.09007.pdf
- https://github.com/NathanUA/U-2-Net
- https://github.com/pymatting/pymatting
License
Copyright (c) 2020-present Daniel Gatis
Licensed under MIT License
Buy me a coffee
Liked some of my work? Buy me a coffee (or more likely a beer)
Metadata
Release files for irembg 1.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| irembg-1.0.14.tar.gz | 11.5 kB | Without provenance | Details for irembg-1.0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| irembg-1.0.14-py3-none-any.whl | Python 3 | none | any | Details for irembg-1.0.14-py3-none-any.whl |
Total release size: 23.9 kB
Release files / irembg-1.0.14.tar.gz
| Download URL | irembg-1.0.14.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ae5c42d3b06f2e491f54910accb0eb813e2b0ef5e272c45baafedf1e3ce67b1
|
|
BLAKE2b-256 checksum How to use checksums |
a27161a69f4055398ad627b699820494bf5afb0728e856fbd580044924854abd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1
|
Release files / irembg-1.0.14-py3-none-any.whl
| Download URL | irembg-1.0.14-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97beb5067955d114e548cd2ebb1fcbeaf295aa11e025fcf7da0daf1c1cfa613d
|
|
BLAKE2b-256 checksum How to use checksums |
b384c4d1f3fef22a6f5d87ec8e8bb458781471989e7bc296cd56cb0c51a99f1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1
|
Security for irembg 1.0.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.