
rembg
Removes the background from images, usable as a command line tool, Python library, HTTP server, or Docker cont
- Stars
- 25.3k
- Forks
- 2.5k
- Licence
- MIT
- Language
- Python
- Last update
- 4 days ago
- Type
- App
What it is
Rembg takes an image and removes its background, leaving the main subject with a transparent background. You can use it from the terminal, from Python code, as a local web server, or in a Docker container. It is handy for preparing product photos, cutouts, or frames from video.
- Remove the background from a single image from the command line with rembg i
- Batch-process a whole folder of images with rembg p, optionally in watch mode
- Run a local HTTP server with rembg s and call its /api/remove endpoint
- Call remove() from a Python script on bytes, PIL images, or NumPy arrays
- Process video frames by piping FFmpeg RGB24 output into rembg b
Great for
- Developers who want to add background removal to a Python program
- Designers or creators batch-processing a folder of photos
- People who want a local tool rather than uploading images to a website
- Video users piping FFmpeg frames through the batch mode
Not ideal for
- Users on Python versions outside 3.11 to 3.13, since the README lists that requirement
- People who need a point-and-click graphical app; the README describes CLI, library, server and Docker usage, with a Gradio UI only as part of the server
- Users with NVIDIA or AMD GPUs who cannot install the matching ONNX runtime and CUDA or ROCm pieces, since the README says GPU setup may be difficult and points to a CPU fallback
How to get it
- 1
Install with a package manager
You'll need: Python >=3.11, <3.14 · pip
Install CPU version with CLI
pip install "rembg[cpu,cli]" - 2
Run it
- Install with pip install "rembg[cpu,cli]"
- Run rembg --help to see the subcommands
- Remove a background with rembg i path/to/input.png path/to/output.png
- Optionally start the web server with rembg s and open http://localhost:7000/api
- 3
Get the most out of it
- Use -m to pick a different model, such as u2netp for a lighter option
- Use -a for alpha matting and -dc for color decontamination on soft edges
- Use -om to output only the mask
- Use rembg p -w to watch a folder and process new files automatically
- Use rembg s --no-ui to reduce idle CPU use when you do not need the Gradio UI
Downloads
Strengths
- Offers several ways to use it: command line, Python library, HTTP server, and Docker
- Supports multiple models and optional alpha matting and color decontamination, per the README
- Released under the MIT license and has a large following on GitHub
Trade-offs
- GPU setup depends on your hardware and can require extra packages such as onnxruntime-gpu, CUDA, and cudnn-devel
- Some options call external cloud APIs (withoutBG, Atlas Cloud) that need API keys and may cost money
- The README is truncated, so the full list of models and Docker steps is not confirmed here
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| rembg (this) | 25.3k | App | intermediate | 4 days ago | Developers who want to add background removal to a Python program |
| supervision | 51.5k | Library | intermediate | 4 days ago | Python developers building apps on top of object detection or segmentation models |
| filepond | 16.4k | Library | intermediate | 9 days ago | Web developers who need a polished upload widget in a site or app |
| blind_watermark | 14.8k | Library | intermediate | 8 months ago | Python developers who want to add a hidden ownership or tracing mark to images |
| segmentation_models.pytorch | 11.8k | Library | intermediate | 4 days ago | Python developers building image segmentation models in PyTorch |
| thumbor | 10.5k | App | intermediate | 4 days ago | Web teams that need many image sizes generated on demand |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.