explaingit

danielgatis/rembg

22,996PythonAudience · developerComplexity · 2/5MaintainedLicenseSetup · moderate

TLDR

Automatically removes backgrounds from images using AI models that run locally on your computer, no internet required.

Mindmap

mindmap
  root((rembg))
    What it does
      Remove image backgrounds
      AI-powered detection
      Local processing
    How to use it
      Command-line tool
      Python library
      HTTP server
    Use cases
      Product photos
      Profile pictures
      Bulk video frames
      Image automation
    Tech stack
      Python
      ONNX Runtime
      CPU or GPU
    Key features
      Multiple models
      No internet needed
      Transparent output

Things people build with this

USE CASE 1

Remove backgrounds from product photos for e-commerce listings automatically.

USE CASE 2

Create profile pictures with transparent backgrounds in bulk.

USE CASE 3

Build image processing pipelines that strip backgrounds from hundreds of photos.

USE CASE 4

Process video frames to remove backgrounds for video editing or compositing.

Tech stack

PythonONNX RuntimeNVIDIA GPUAMD GPU

Getting it running

Difficulty · moderate Time to first run · 30min

ONNX Runtime and GPU drivers (NVIDIA/AMD) must be installed; model download on first run.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Rembg is a Python tool that automatically removes the background from images. You give it a photo and it returns the same photo with the background cut out, leaving just the subject, a person, product, object, or whatever is in the foreground. The problem it solves: removing backgrounds manually in photo editing software is time-consuming. Rembg does it automatically using AI models, in seconds, without any manual selection or tracing. How it works: the tool runs an AI model (you choose from several included models) that analyzes each pixel in an image and decides whether it belongs to the foreground subject or the background. It then removes the background pixels and outputs a transparent image. The AI models run locally on your machine using your CPU or GPU, so no internet connection or external service is required after the initial model download. You would use Rembg when processing product photos for an online store, creating profile pictures with transparent backgrounds, building image editing automation pipelines, or processing video frames to remove backgrounds in bulk. It can be used as a command-line tool, a Python library you import into your own code, or as a self-hosted HTTP server that other apps can call. The tech stack is Python, with AI model inference running via ONNX Runtime (a cross-platform engine for running AI models) on CPU, NVIDIA GPU, or AMD GPU.

Copy-paste prompts

Prompt 1
Show me how to use rembg as a Python library to remove backgrounds from all images in a folder and save them with transparency.
Prompt 2
How do I set up rembg as a local HTTP server so other applications can send images to it for background removal?
Prompt 3
What are the different AI models available in rembg and how do I choose which one to use for my images?
Prompt 4
Give me a command-line example of using rembg to process a batch of product photos and output them with transparent backgrounds.
Prompt 5
How do I use rembg with a GPU to speed up background removal on hundreds of images?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.