selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GitHub
Rembg logo

Self-host Rembg

v2.0.87

Remove image backgrounds via CLI, library, server, Docker

ReleaseOpen SourceMIT
docker run -v .:/data danielgatis/rembg i /data/input.png /data/output.png
Updated3 days ago
LanguagePython
Setup difficultyEasy
Stars
25 387
Storage
~1.6GB (CPU image), ~11GB (NVIDIA CUDA GPU image, models not included)
Requires
ONNX Runtime
Docker
danielgatis/rembg

What is Rembg?

Rembg strips the background out of images and offers the same engine four ways: a Python library, a command-line tool, a local HTTP server with a REST API and a Gradio page, and a Docker container. It supports a set of ONNX segmentation models - the u2net family, ISNet, several BiRefNet checkpoints, SAM and BRIA's RMBG-2.0, which is the default - fetching weights automatically into a local model directory on first use, and it can be pointed at your own converted model files. Edge-quality options cover alpha matting, ViTMatte, colour decontamination, mask-only output and background colour replacement, along with batch processing of whole folders including a watch mode. Inference runs on CPU or with NVIDIA CUDA and AMD ROCm GPUs. Install it with pip (Python 3.11 to 3.13) or pull danielgatis/rembg and pass the same rembg subcommands to docker run; the server listens on port 7000. Two optional backends send images to the commercial withoutBG and Atlas Cloud APIs instead of a local model. The code is MIT-licensed, while each model carries its own terms: the default RMBG-2.0 weights need a BRIA commercial deal before business use.

Rembg alternatives

Should you self-host Rembg?

Rembg scores 79/100 on selfhost.directory (how scoring works) and ranks #1 of 13 in Image Processing. It has 25 387 GitHub stars, +248 in the last 30 days.

It shipped 12 stable releases in the past year. The latest, v2.0.87, came out on 6 November 2026. New versions land roughly every 2 weeks.

Setup is easy: most people get it running in one sitting. An official Docker image is available. It is MIT-licensed and written mostly in Python.

Its closest alternative on selfhost.directory is Thumbor (73/100, 10 532 stars). Rembg scores higher overall. See Rembg vs Thumbor side by side.

Features

  • Alpha matting
  • Background colour replacement
  • Batch folder processing
  • Built-in web UI
  • Colour decontamination
  • Command Line Interface
  • Custom Model Support
  • GPU Acceleration
  • HTTP server mode
  • Image background removal
  • Mask-only output
  • Multiple AI segmentation models
  • Python library API
  • REST API
  • ViTMatte edge refinement

Rembg README

Rembg Logo

Rembg is a tool to remove image backgrounds. It can be used as a CLI, Python library, HTTP server, or Docker container.

License Hugging Face Spaces Streamlit App Open in Colab RepoMapr

danielgatis%2Frembg | Trendshift

How to install Rembg

Install Rembg with Docker

docker run -v .:/data danielgatis/rembg i /data/input.png /data/output.png
docker build -t rembg-nvidia-cuda-cudnn-gpu -f Dockerfile_nvidia_cuda_cudnn_gpu .
sudo docker run --rm -it --gpus all -v /dev/dri:/dev/dri -v $PWD:/data rembg-nvidia-cuda-cudnn-gpu i -m birefnet-general /data/input.png /data/output.png

CPU image is published as danielgatis/rembg; the CUDA image is built locally and the host needs the NVIDIA Container Toolkit. Mount a models folder at /root/.rembg to avoid re-downloads.

How to configure Rembg

  • REMBG_HOMEPath to the directory where models are stored. Defaults to `$XDG_DATA_HOME/rembg` (or `~/.rembg` if `XDG_DATA_HOME` is not set).
  • XDG_DATA_HOMEBase data directory used when `REMBG_HOME` is not set.
  • U2NET_HOMEDeprecated. Still honored, and still takes precedence over `REMBG_HOME` when set, so existing setups keep working. Prefer `REMBG_HOME`.
  • MODEL_CHECKSUM_DISABLEDWhen set (e.g. `MODEL_CHECKSUM_DISABLED=1`), disables hash verification for downloaded models. This is useful if you want to use your own custom/converted model files without rembg re-downloading the originals.
  • OMP_NUM_THREADSSets the number of threads used by ONNX Runtime for inference.

Rembg releases & version history

@ Every self-hosted release, weekly

One Monday email with the week's stable releases across the directory.

FAQ

When will this library support Python version 3.xx?

Python support follows whatever versions the ONNX Runtime dependency itself supports, so it is decided by onnxruntime compatibility rather than by Rembg.

More in Image Processing

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…