danielgatis/rembg
59.7
Adequate · 18 September 2026
3.6k
lines of production code
Python
primary language
1
measurement over time
What this system is
This system is a Python library and command-line tool for removing image backgrounds, supporting a wide range of modern AI models including BiRefNet, Bria-RMBG, and SAM. It provides flexible processing capabilities via CLI commands, an HTTP server, and a Python API, with robust support for CPU and GPU execution across various hardware providers. The tool also includes features for high-quality edge refinement and color decontamination, along with utilities for model management and migration.
Features
Add manual page for the CLI
Users can now access the command-line interface documentation via the standard man page (man rembg), which covers the tool's purpose, basic usage, and available options like --version and --help.
man · high confidence
New BiRefNet, Bria-RMBG, and SAM model sessions with GPU fallback warnings
The session registry now includes support for BiRefNet (General, Portrait, DIS, COD, HRSOD, Massive), Bria-RMBG 2.0, and Segment Anything Model (SAM) sessions. The base session logic has been updated to automatically select CUDA, ROCm, or OpenVINO providers when available, and will now emit a warning if a GPU provider is requested but the session silently falls back to CPU execution.
rembg/sessions · high confidence
Removals
Removal of legacy CLI and server command-line entry points
The legacy command-line interface (cli.py) and the Flask-based web server (server.py) modules within the src/rembg/cmd package have been removed. This eliminates the built-in command-line tool for batch processing images and the standalone HTTP server for remote background removal, simplifying the package structure by removing these specific entry points.
src/rembg/cmd · high confidence
Removal of legacy U2Net implementation
The legacy U2Net module in \src/rembg/u2net\ has been completely removed. This deletes the internal data loading, model definition (RSU blocks), and detection logic that previously handled model downloading and inference, indicating a shift away from this specific implementation within the rembg package.
src/rembg/u2net · high confidence
Removal of legacy background removal implementation
The legacy background removal module, previously located in src/rembg/bg.py, has been removed. This file contained the core logic for loading u2net and u2netp models and performing image background removal using PIL and numpy. Its deletion indicates a structural change to the library, likely preceding or accompanying a refactoring of the core API or model handling logic.
src/rembg · high confidence
Architecture
Project migration to Poetry and modern packaging standards
The project has migrated its build system from setuptools (setup.py) to Poetry, introducing pyproject.toml and poetry.lock while removing legacy setup.cfg and setup.py. This change updates the Python version requirement to \>=3.11, adds a .python-version file specifying 3.13.9, and introduces new Dockerfiles for CPU and NVIDIA CUDA environments. Additionally, Windows installation is now supported via Inno Setup scripts that build standalone executables for both CPU and GPU variants, and a new USAGE.md file provides detailed documentation for the CLI and Python API.
(repo-wide) · high confidence
Behavioural changes
CLI commands restructured and HTTP server hardened
The command-line interface has been reorganized into a modular structure under \rembg/commands\, introducing dedicated commands for byte streams (\b\), file processing (\i\), folder processing (\p\), and model migration (\m\). The HTTP server (\s\) now includes a \--no-ui\ flag to disable the Gradio interface and reduce idle CPU usage, and enforces stricter SSRF protections by blocking IPv6 transition addresses. Additionally, the default model for background removal has changed to \bria-rmbg\.
rembg/commands · high confidence
ViTMatte edge refinement and color decontamination for softer cutouts
Users can now achieve higher-quality background removal with finer edge details, particularly for hair and fur, by enabling the opt-in ViTMatte edge refinement (via the \-vm\ flag) and color decontamination. The new matting module uses a ViTMatte ONNX model to refine coarse masks into precise alpha mattes, recovering soft details that standard segmentation might miss. Additionally, the \decontaminate\_cutout\ function removes background color fringing from semi-transparent pixels, resulting in cleaner edges. The default model has also been updated to bria-rmbg.
rembg · high confidence
Test coverage
Added test coverage for new and modified features
Added comprehensive tests for several new capabilities and behavioral changes: color decontamination for soft edges (test\_decontaminate.py), ViTMatte edge refinement variants and trimap generation (test\_matting.py), the new per-model model storage layout and migration command (test\_migrate.py, test\_model\_home.py), GPU provider fallback warnings (test\_provider\_fallback.py), the expanded set of supported models including BiRefNet variants (test\_remove.py), SAM model allowlist and checksum pinning (test\_sam\_model\_allowlist.py), IPv6 transition address blocking in the SSRF guard (test\_ssrf\_ipv6\_transition.py), and the new WithoutBg session integration (test\_withoutbg.py).
tests · high confidence
Dependencies
Migration from requirements.txt to Poetry with optional dependency groups
The project has replaced the flat requirements.txt file with a pyproject.toml configuration managed by Poetry. This introduces optional dependency groups (extras) for CPU, GPU, ROCm, CLI, and dev environments, allowing users to install only the specific components they need (e.g., \pip install rembg\[gpu\]\). Core dependencies have been updated to newer versions (e.g., numpy ^2.3.0, pillow ^12.1.0), and the build system now uses poetry-core with dynamic versioning.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 60.
Lenses
- Code Health 97
- Architecture 100
- Maturity 51
- Readiness 50
- Security 75
Changes since last survey
- 300 commits — 201 feature/other, 99 fixes
By area
- (root) — 104 commits
- (repo) — 50 commits
- rembg/sessions — 46 commits
- rembg/commands — 35 commits
- .github/workflows — 22 commits
- rembg/bg.py — 14 commits
- rembg/session_factory.py — 13 commits
- tests/results — 8 commits
- rembg/cli.py — 4 commits
- rembg/session_sam.py — 2 commits
- man/rembg.1 — 1 commit
- rembg/session_base.py — 1 commit
Notable commits
- fix: Dependency fix (#691)
- fix: FIX issue 462, nargs error (#547)
- fix: Fix (and document) support for ROCM backend
- fix: Fix SSRF and CORS misconfiguration in HTTP server ([GHSA redacted])
- fix: Fix Windows installer missing Python modules (#822)
- fix: Fix broken PhotoRoom sponsor logo in README
- fix: Fix code scanning alerts: workflow permissions, SSRF redirects, Gradio path handling
- fix: Fix crash in rembg i when output path is omitted (#829)
- fix: Fix issue 474 (#475)
- fix: Fix issue base.py
- fix: Fix model not being kept in memory between Gradio requests (#816)
- fix: Fix path traversal vulnerability in custom model sessions ([GHSA redacted])
- fix: Merge pull request #719 from calledit/revert-718-patch-1
- fix: Merge pull request #730 from serg123e/fix-dis-normalization
- fix: Merge pull request #737 from pgr0ss/fix-readme
- fix: Merge pull request #782 from kianmeng/fix-typos-again
- fix: Revert "rembg b - return a stream of RGB24 instead of a mess of consecutive pngs"
- fix: added fix for image orientation
- fix: fix #434
- fix: fix #434
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
danielgatis/rembg was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 18 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 47ac53f593ac1f7e6b17c3531ee4a455de092bcb — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-5d04157a340d.