rembg is an AI-model-powered tool for removing image backgrounds, usable as a CLI, Python library, HTTP server, or Docker container, running local inference to cut out subjects with transparent backgrounds.
- v2.0.86
- Published at
- 6d ago
- 25,156
- Stars
- 3,372
- Download
- Synced at
- 6d ago
Latest release
v2.0.86Oct 21, 2026, 09:17 PMDownloads slow? Switch the source anytime above
README
Project Overview
rembg is a tool for removing image backgrounds, separating the foreground subject from the backdrop with built-in AI models such as U2Net. It runs as a CLI, a Python library, an HTTP server, or a Docker container, and inference happens locally so images never need to leave your machine for a third-party service.
| Item | Value |
|---|---|
| Platforms | Linux, macOS, Windows, Docker |
| Language | Python 3.11 to 3.13 |
| License | MIT |
| Inference engine | ONNX Runtime |
Local AI background removal — one command lifts the subject out of the frame.
Key Features
- One-click removal: feed it any image and it detects the subject, returning a transparent-background result
- Multiple modes: command line, Python library, HTTP server, and Docker container
- Model choice: ships with u2net, isnet, and other models that can be swapped per scene, people or objects
- CPU and GPU: CPU inference by default, with onnxruntime-gpu acceleration for NVIDIA cards
- Alpha matting: optional edge refinement makes fine details like hair blend naturally
- Batch processing: the CLI can process a whole directory of images
Target Audience
- E-commerce and asset production staff
- Content teams batch-processing images
- App developers embedding background removal
- Privacy-conscious designers who need local processing
Quick Start
- Install the backend that matches your hardware
pip install 'rembg[cpu,cli]'- Process a single image from the command line
rembg i input.png output.png- Or call it in code
from rembg import remove
from PIL import Image
inp = Image.open('input.png')
remove(inp).save('output.png')Core Advantages
- Local inference: models run on your machine, images stay inside the network
- Flexible modes: one capability serves personal scripts through production deployments
- Ready out of the box: models download automatically on first run, no manual setup
System Requirements
| Item | Requirement |
|---|---|
| Language | Python 3.11 up to, but not including, 3.14 |
| OS | Linux, macOS, Windows |
| Hardware | CPU works; NVIDIA GPU enables acceleration |
Notes
- Models download on first run: the model files are large; pre-place them manually if your network is slow
- Results vary by image: for subjects close in color to the background or with complex edges, try a different model or enable alpha matting
Release history
Sort