Background & CleanupOpen source codedanielgatis/rembg

Rembg: Open Source AI Repository & Self-Hosting Guide

Open-source Python, CLI, and HTTP server background-removal engine powered by U2-Net, IS-Net, and BiRefNet ONNX segmentation models.

GitHub Stars
25,942 stars
Repository License
MIT
Last Push (UTC)
Nov 24, 2026
Check the repo's license. Model weights may have a different license.
git clone https://github.com/danielgatis/rembg.git
View on GitHub
Installpip install 'rembg[cli]' && rembg i input.png output.png

Rembg: Architecture & Practical Workflow

Rembg streamlines alpha-matting across single images, CLI glob folders, and Docker web endpoints with multiple switchable ONNX models tuned for products, anime, humans, and fine hair edges—no cloud credits or per-cutout watermarks.

Recommended End-to-End Pipeline

Batch-process raw e-commerce product photos through `rembg p raw_dir/ cutout_dir/ -m birefnet-general` before compositing into Slidev or Remotion assets.

Runtime Target
Self-Hosted / CLI, Python & Docker (GitHub)
Primary Users
E-commerce Sellers, Designers, Automation Scripts
Code License
MIT
Focus Topics
open-source, github, background-remover, batch-image

Quick Setup & Installation Steps

Platform target: Self-Hosted / CLI, Python & Docker (GitHub). Always verify environment variables and dependencies in the upstream repository README.

  1. 1Clone the repository from GitHub: `git clone https://github.com/danielgatis/rembg.git && cd rembg`.
  2. 2Review the MIT license (Check the repo's license. Model weights may have a different license.) and note any separate terms on external model weights.
  3. 3Install or launch the project directly: `pip install 'rembg[cli]' && rembg i input.png output.png` (use an isolated Python virtualenv, Node workspace, or Docker volume so dependencies remain clean).
  4. 4Validate end-to-end behavior with a small sample input (Batch-process raw e-commerce product photos through `rembg p raw_dir/ cutout_dir/ -m birefnet-general` before compositing into Slidev or Remotion assets.)

Hardware & VRAM Notes

Lightweight to orchestrate on standard CPUs or Docker hosts; heavier local model inference can be offloaded to Ollama, vLLM, or external APIs.

CPU & Memory

Modern multi-core CPU with 8 GB–16 GB RAM for orchestration, CLI agents, OCR/document parsing, or UI workflows (32 GB+ if co-hosting large local LLMs).

GPU / VRAM

Optional unless running local neural weights; pairs cleanly with local inference servers (Ollama / llama.cpp) or remote endpoints.

Runtime Target

Self-Hosted / CLI, Python & Docker (GitHub)

Strengths & Best For

  • Automatic subject segmentation using U2-Net, BiRefNet, and ISNet models
  • Bulk folder processing via CLI or Docker REST API
  • Free local execution with no forced watermark or resolution caps
  • Best suited for: E-commerce Sellers, Designers, Automation Scripts

Limitations & Caveats

  • CLI/API workflow rather than a hosted web editor
  • Complex hair/glass edges look best with BiRefNet model weights
  • Check the repo's license. Model weights may have a different license.

3 Similar Tools on /tools (Watermark & Background)

Prefer a hosted web app instead of managing local weights or Docker containers? Explore these cloud alternatives.

Browse all tools
Self-Hosted Rembg vs. Hosted Alternatives (IOPaint (Lama Cleaner) & Remove.bg)
FactorRembg (Self-Hosted)IOPaint (Lama Cleaner)Remove.bg
Execution & PrivacyRuns locally via Self-Hosted / CLI, Python & Docker (GitHub); data stays on your disk or private server.Hosted cloud web interface; zero local dependency setup required.Hosted cloud web interface; zero local dependency setup required.
Cost & QuotaMIT code; bound only by local CPU/GPU hardware.Open Source; subject to vendor free-tier limits or paid plans.Freemium; subject to vendor free-tier limits or paid plans.
Primary FitAutomatic subject segmentation using U2-Net, BiRefNet, and ISNet models; Bulk folder processing via CLI or Docker REST API100% free and open-source image inpainting & watermark eraser powered by SOTA AI models.AI background removal for images. Instant 1-click transparent cutouts with free tier.
Key Trade-offCLI/API workflow rather than a hosted web editorRequires internet access and vendor account/quota limits.Requires internet access and vendor account/quota limits.

Matching Ready-Made Prompts

All Prompts →

Customize variables in Live Prompt Studio for Rembg workflows.

Golden Ratio Abstract Tech & Startup LogoImage · Branding, Vector, Minimalist, Logo
Open in Studio
Commercial Studio Travertine Product PhotographyImage · E-Commerce, Product, Commercial, Photorealistic
Open in Studio

Compare Alternatives

Compare Engine →

Compare Rembg side-by-side on setup ease, privacy, and role scorecards.

More Open Source Background & Cleanup Repositories

Frequently Asked Questions

What does Rembg do and how does it work?

Rembg (danielgatis/rembg) is an open-source background & cleanup project with 25,942 stars on GitHub. Open-source Python, CLI, and HTTP server background-removal engine powered by U2-Net, IS-Net, and BiRefNet ONNX segmentation models. Rembg streamlines alpha-matting across single images, CLI glob folders, and Docker web endpoints with multiple switchable ONNX models tuned for products, anime, humans, and fine hair edges—no cloud credits or per-cutout watermarks.

Is Rembg free to self-host and use commercially?

Rembg provides open source code licensed under MIT. Check the repo's license. Model weights may have a different license. Always verify both source code and model weight licenses in the GitHub repository before commercial deployment.

What hardware, runtime, or VRAM does Rembg require?

Rembg targets Self-Hosted / CLI, Python & Docker (GitHub). Typical installation runs via `pip install 'rembg[cli]' && rembg i input.png output.png`. CLI/API workflow rather than a hosted web editor

How does self-hosting Rembg compare to hosted tools like IOPaint (Lama Cleaner)?

Self-hosting Rembg gives you full local data control, zero per-usage vendor fees, and customizable Self-Hosted / CLI, Python & Docker (GitHub) pipelines—at the cost of managing your own setup and compute. By contrast, IOPaint (Lama Cleaner) (Open Source) runs in the browser with no local installation, though usage quotas and cloud privacy policies apply.

Is Rembg actively maintained and what workflow fits it best?

Repository metadata records 25,942 stars on GitHub with the latest recorded push on Nov 24, 2026. Batch-process raw e-commerce product photos through `rembg p raw_dir/ cutout_dir/ -m birefnet-general` before compositing into Slidev or Remotion assets.