3 min read

rembg: Remove Image Backgrounds Locally (GitHub, Scanned)

Removes image backgrounds on your own machine, from the command line, a Python call or a small web server.

rembg logo
✅
Scan: safe. Nothing malicious. Two things to know: the default model, BRIA RMBG 2.0, needs a paid licence for commercial use, and rembg s listens on all network interfaces unless you pass --host. Scanned Sep 20, 2026; the full report is below.

rembg does one job: give it an image, get back the subject on a transparent background. It wraps a set of segmentation models (U2-Net, IS-Net, BiRefNet, SAM and BRIA's RMBG 2.0) behind one command, rembg i input.png output.png, plus a batch mode that processes or watches a folder, a Python function, and an HTTP server with a small web UI. Models run through ONNX Runtime on a CPU or on NVIDIA and AMD GPUs, and download on first use.

It earns its place as the quiet dependency behind a lot of scripts and pipelines that need a cutout without sending the image to a web service. The code is MIT-licensed and small, about 6,600 lines, and Daniel Gatis has maintained it almost single-handedly since 2020. The catch is the default model: BRIA's RMBG 2.0 needs a paid agreement for commercial use, so businesses should choose another one.

  • Repository: github.com/danielgatis/rembg
  • Licence: MIT (MIT License)
  • Language: Python. Stars: 24.9K. Forks: 2,423. Last push: Sep 20, 2026.
  • Scan: safe, Sep 20, 2026, commit 202e426

Who it is for

Developers and designers who need background removal in a script or pipeline, sellers processing product photos in bulk, and anyone who would rather not upload their images to a web service.

Getting started

1. Install the library and CLI for CPU (Python 3.11 to 3.13; rembg[gpu,cli] for NVIDIA)

pip install "rembg[cpu,cli]"

2. Remove a background; the first run downloads the default model, about 1 GB

rembg i path/to/input.png path/to/output.png

3. Or pick a smaller, faster model

rembg i -m u2net path/to/input.png path/to/output.png

4. Or run it with Docker, on files in the current directory

docker run -v .:/data danielgatis/rembg i /data/input.png /data/output.png

Safety scan

We cloned danielgatis/rembg at commit 202e426 on Sep 20, 2026 and ran the checks described on the GitHub Tools page: credential patterns, decode-and-execute code, install-time scripts, committed binaries, risky CI workflows, every host the code talks to, known vulnerabilities in pinned dependencies, and project hygiene. A person read every hit. This is what we found.

  • The scan found nothing to explain: no secrets, no pattern hits, no install hooks, no binaries and no bare-IP URLs in about 6,600 lines, mostly Python.
  • Model files download from the project's GitHub releases on first use and are checked against MD5 or SHA-256 hashes before loading, unless you set MODEL_CHECKSUM_DISABLED. The one cloud service in the code is withoutbg, an optional model that sends your image to withoutbg.com only when you choose it and supply an API key.
  • rembg s, the HTTP server, defaults to host 0.0.0.0 on port 7000, so anyone on your network can reach it. Pass --host 127.0.0.1 for local-only use.
  • No lockfile, so there was nothing for the advisory check to query; dependencies are version ranges in pyproject.toml. Five workflows, none using pull_request_target, and none of the 11 third-party actions is pinned to a commit. Licence present; no security policy, Dependabot or CodeQL. OpenSSF Scorecard: 4.3 of 10, lost on process (branch protection, code review, pinning) rather than on anything in the code.

What the scanner counted

CheckResult
SecretsNone found.
Suspicious codeNone found.
Install-time codeNone: nothing runs at install beyond the package manager itself.
Committed binariesNone.
CI workflows5 workflows. None use pull_request_target. 11 of 11 third-party actions pinned to a tag rather than a commit.
Network hosts5 distinct hosts referenced from source; most often github.com, api.withoutbg.com, huggingface.co, www.sciencedirect.com. No URLs to bare IP addresses.
Known vulnerabilitiesNo lockfile to check: dependencies are declared as ranges, so what gets installed is whatever is current on the day.
Project hygieneHas licence file. Missing security policy, automated dependency updates, CodeQL, contributing guide.
OpenSSF Scorecard4.3 out of 10, as of Sep 21, 2026.

By the numbers

Stars24.9K
Forks2,423
Contributors85
Commits554
Open issues0
Open pull requests1
Releases72
Latest releasev2.0.85
LicenceMIT
Main languagePython
Project age6 years
Last pushSep 20, 2026
Tracked files125
Lines of code6,585
Checkout size25 MB

Lines by language: Python 5,448, Markdown 726, YAML 249, TOML 99, Jupyter 40, PowerShell 23.

Questions

Is rembg free?

The code is MIT-licensed and free for any use. The models are another matter: each carries its creator's licence, and the default, BRIA RMBG 2.0, requires a paid agreement with BRIA for commercial use. U2-Net, IS-Net and BiRefNet come from research projects with their own, generally more permissive, terms; check the linked source before shipping. The optional withoutbg cloud model is a paid API with free starter credits.

Does rembg need a GPU?

No. It runs on a CPU through ONNX Runtime. The default model is large (about 1 GB, working at 1024 by 1024 pixels) and noticeably slower there, while u2net and birefnet-general-lite are far lighter. For bulk work, the gpu extra runs ONNX Runtime on CUDA, and a ROCm build covers AMD cards.

Does rembg upload my images?

No, unless you choose the withoutbg model, which is a cloud API and says so. Every other model runs locally after a one-time download from the project's GitHub releases, stored under ~/.rembg/models by default (or wherever REMBG_HOME points). Server mode keeps images on whatever machine runs it.


This post is part of GitHub Tools, where every repository is cloned and scanned before it is written up. The scan is a snapshot of one commit on one day; the repository has moved on since, so check it before you install.