danielgatis/rembg
Rembg is a tool to remove images background
What it solves
Rembg provides a way to automatically remove backgrounds from images, allowing users to isolate the foreground subject. It addresses the challenge of creating clean cutouts, especially when dealing with complex edges like hair, fur, or fabric, and removes colored halos (fringing) that often occur when a subject is shot against a strongly colored background.
How it works
It uses pre-trained ONNX models to perform image segmentation. The tool can be deployed as a command-line interface (CLI), a Python library, an HTTP server, or a Docker container. It supports multiple hardware backends including CPU, NVIDIA GPUs (via CUDA), and AMD GPUs (via ROCm). To refine the output, it offers several edge modes:
- Naive: The default for hard edges.
- Decontaminate: Removes colored rims from soft edges.
- Alpha matting: Re-estimates coverage for soft shapes (e.g., hair).
- ViTMatte: A neural network-based approach for high-detail alpha prediction.
Who it’s for
- Developers who want to integrate background removal into their own Python applications.
- System administrators or automation engineers who need to batch-process folders of images via CLI or Docker.
- Content creators looking for a fast way to remove backgrounds from images or video frames (via FFmpeg integration).
Highlights
- Multiple Deployment Options: Available as a CLI, Python library, HTTP server, and Docker image.
- Extensive Model Library: Supports a wide range of models including U2Net, BiRefNet, ISNet, SAM, and the state-of-the-art BRIA RMBG-2.0.
- Hardware Acceleration: Native support for CPU, NVIDIA CUDA, and AMD ROCm.
- Advanced Edge Refinement: Includes specialized modes for color decontamination and alpha matting to handle complex transparency.
- Video Support: Can process RGB24 pixel streams, making it compatible with tools like FFmpeg for video background removal.
Related
- Project
- Project
- Project
- Project
- Project