rembg
Remove image background
What it is and what it does
This package is a background removal tool built on deep learning models that strips backgrounds from images and returns them with transparency. It works with multiple input formats—bytes, NumPy arrays via scipy/scikit-image, or file paths—and can be used as a Python library, command-line tool, HTTP server, or Docker container. The package depends on core image processing libraries (pillow, scikit-image, scipy, numpy) and uses pooch for model management and tqdm for progress reporting.
The library supports multiple backends: CPU-only for universal compatibility, NVIDIA/CUDA for GPU acceleration on compatible systems, and AMD/ROCm for Radeon GPUs. It also integrates with the withoutBG cloud API as an alternative to local processing. Batch processing with session reuse is recommended for performance when handling multiple images. jsonschema is used for configuration validation.
Use it for:
- Remove backgrounds from product photos for e-commerce listings or catalog preparation
- Batch process entire folders of images with watch mode for automated workflows
- Serve background removal as an HTTP API endpoint for web applications or backends
- Extract foreground objects from images for compositing or further manipulation
- Process video frames via FFmpeg piping for background removal in video workflows
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Removes image backgrounds using deep learning models, available as a Python library, CLI tool, HTTP server, or Docker container.
Yes. Actively maintained, no known vulnerabilities, low install friction, and flexible deployment options (library, CLI, server, Docker). MIT license is permissive. Choose it for local background removal with optional GPU acceleration; consider the withoutBG cloud API integration if you prefer managed processing.
Install
rembg on PyPI
pip
pip install rembguv
uv add rembgpoetry
poetry add rembgInstalling rembg
Before you install
Low install friction with a pure-Python wheel. Active maintenance—released 8 days ago with 24254 GitHub stars. Requires Python >=3.11, <3.14. Optional GPU acceleration (NVIDIA/CUDA or AMD/ROCm) requires system-level dependencies; CPU-only installation is straightforward.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects.
Quickstart
pip install "rembg[cpu]"
from rembg import remove
with open('input.png', 'rb') as i:
with open('output.png', 'wb') as o:
input_data = i.read()
output = remove(input_data)
o.write(output)
Requires Python >=3.11, <3.14. GPU support (NVIDIA/CUDA or AMD/ROCm) requires additional system-level dependencies; CPU-only mode works without them.
Verify before relying
- Model download and caching behavior (pooch is a dependency but caching strategy not specified)
- Performance characteristics and memory requirements for different image sizes
- Accuracy and speed comparisons across supported model variants
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — jsonschema, numpy, pillow, pooch, pymatting, scikit-image, scipy, tqdm |
| Maintenance | actively maintained — 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,741,705/month — #2,509 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rembg-2.0.78-py3-none-any.whl
Keywords: remove, background, u2net
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
PyMattingPyMatting solves the alpha matting…
permissive · top 5,000 on PyPI
nvidia-cudnn-cu11Provides cuDNN runtime libraries for…
unclear · top 5,000 on PyPI
realesrganReal-ESRGAN upscales images and videos using…
permissive · top 15,000 on PyPI
transparent-backgroundRemoves backgrounds from images and videos…
permissive · top 15,000 on PyPI
nudenetDetects nudity in images using lightweight ONNX…
permissive · top 15,000 on PyPI
audio-separatorSeparates audio files into multiple stems…
permissive · top 15,000 on PyPI
nvidia-cuda-runtimeProvides NVIDIA CUDA Runtime native libraries…
unclear · top 1,000 on PyPI
tensorflowTensorFlow is an open-source machine learning…
permissive · top 5,000 on PyPI
nvidia-cuda-runtime-cu11Provides CUDA 11 runtime native libraries for…
unclear · top 5,000 on PyPI