Favicon of rembg

rembg

Local AI background removal tool with ONNX models, CPU and GPU support, and a Python library or self-hosted HTTP API. MIT licensed.

rembg removes image backgrounds on your own hardware, with batch processing and a Python library for developers building image workflows. It's also useful for people preparing product cutouts or portraits who want control over processing and model choice. Local models keep images on your machine and can work offline once downloaded.

You can process individual images or entire folders, automatically handle new or changed files, and export cutouts or masks. A self-hosted HTTP server includes a browser interface, and Docker is supported. The Python library accepts image bytes, PIL images and NumPy arrays; FFmpeg workflows can pass image frames through it.

Model choice affects both speed and detail. The default, bria-rmbg, produces softer edges but runs more slowly than u2net. Other choices include birefnet-portrait for portraits, isnet-anime for anime characters, and SAM with point prompts. rembg uses ONNX models and supports CPU processing, NVIDIA GPUs through CUDA, and AMD GPUs through ROCm.

Edge correction addresses colored halos around hair, fur and other soft boundaries. Alpha matting and ViTMatte can refine transparency and recover fine detail, at the cost of slower processing.

The software is open source under MIT, while model weights have separate licenses. The default BRIA model requires a separate agreement for commercial use. An optional withoutBG backend sends images to its cloud servers and requires an API key.

Similar to rembg