| Name | Latest commit | Last update |
|---|---|---|
| 📂 src | ||
| 📂 tests | ||
| 📄 .gitignore | Add a local RMBG mask generation CLI | 9 hours ago |
| 📄 README.md | Add a local RMBG mask generation CLI | 9 hours ago |
| 📄 pyproject.toml | Add a local RMBG mask generation CLI | 9 hours ago |
| 📄 uv.lock | Add a local RMBG mask generation CLI | 9 hours ago |
rmbg-mask generates an 8-bit grayscale foreground mask from an image using
a local copy of the RMBG 2.0 model. It never downloads model files.
RMBG 2.0's downloadable weights are restricted to non-commercial use unless you have a separate commercial agreement with BRIA. Review the model license before using this program.
For development with uv:
uv sync
uv run rmbg-mask --help
Alternatively, install the project with pip:
python -m pip install .
rmbg-mask --help
Download RMBG 2.0 separately and place all of its repository files in one local directory. Then run:
rmbg-mask input.jpg mask.png --model /path/to/RMBG-2.0
The output mask has the same dimensions as the input image. White represents foreground, black represents background, and intermediate values preserve the model's soft edges.
Use --processing-resolution (or -r) to control the square resolution used
for inference:
rmbg-mask input.jpg mask.png \
--model /path/to/RMBG-2.0 \
--processing-resolution 1536
Higher resolutions may retain more detail, but use substantially more memory and processing time. The default is 1024.
The device defaults to CUDA when available, then MPS, then CPU. It can be selected explicitly:
rmbg-mask input.jpg mask.png --model ./RMBG-2.0 --device cpu
The unit tests do not load the model:
uv run python -m unittest discover -s tests