# rembg

> Rembg is a tool to remove images background

- Type: agent or tool
- Field: Image & Design
- Repository: https://github.com/danielgatis/rembg
- GitHub stars: 25669
- Licence: MIT
- Language: Python
- Last push: 2026-11-24
- Page: https://imutechz.in/agents/rembg

## What it is
Rembg removes image backgrounds using AI models. It runs as a command-line tool, Python library, HTTP server, or Docker container. Supports CPU and GPU backends with multiple model options including u2net, SAM, and cloud APIs. Requires Python 3.11 to 3.13.

## Features
- CLI with subcommands for single files, batch folders, HTTP server, and model management
- Python library for programmatic background removal
- Multiple model support: u2net, u2netp, SAM, custom ONNX models, and cloud APIs
- Alpha matting and color decontamination for edge refinement
- CPU, NVIDIA CUDA, and AMD ROCm GPU acceleration options
- HTTP server mode for API access

## Best for
- Removing backgrounds from single images or batches
- Integrating background removal into Python applications
- Running a local HTTP API for background removal
- Processing images with transparent backgrounds for design workflows

## Pros
- Multiple interfaces: CLI, library, server, Docker
- Supports various hardware backends (CPU, CUDA, ROCm)
- Choice of models including SAM for prompt-based segmentation
- MIT license

## Cons
- Requires Python 3.11-3.13 (excludes older/newer versions)
- GPU support needs compatible onnxruntime and CUDA/ROCm setup
- Cloud API usage requires API key and credits

## Install
```
pip install "rembg[cpu,cli]"
```

## Usage
```
rembg i path/to/input.png path/to/output.png
```

Tags: background-removal, image-processing, cli-tool, python-library, onnx, computer-vision, docker, http-server
