OPEN SOURCE · Python · MIT · Image

rembg
Python cross-platform background removal, U²-Net/ISNet/BiRefNet/SAM in one line
Where it fits in the workflow
rembg is an open-source Python background-removal library maintained by danielgatis, first released in 2020, MIT (most permissive), with GitHub primarily in Python + ONNX Runtime + PyTorch. It wraps multiple SOTA segmentation models (U²-Net, ISNet, BiRefNet, SAM, Silueta, etc.) and exposes a CLI / Python API / HTTP server, completing foreground segmentation of humans, products, and generic subjects in a few lines, automatically outputting transparent PNG.
Core capabilities center on a unified multi-model interface + easy deployment. Model family defaults to u2net (with sub-models u2netp / u2netp_quantized / u2net_human_seg / u2net_cloth_seg); also supports isnet-general-use / isnet-anime / birefnet-general / birefnet-portrait / briaai-rmbg / sam. Models auto-download to ~/.u2net / ~/.isnet locally. CLI: rembg i input.png output.png is one line; supports --model flag and rembg p to start an HTTP service (POST files to / and get PNG back). Python API: from rembg import remove; remove(input_bytes) returns PNG bytes; supports alpha matting / post-process mask / only-mask output. Acceleration: ONNX Runtime (CPU/GPU), CUDA / CoreML / DirectML backends; FP16 available; CPU on 1024x1024 image ~1-3 seconds (model-dependent). Ecosystem: ComfyUI has a rembg node (ComfyUI-rembg); Houdini / Blender / GIMP plugins; the open-source alternative to remove.bg.
Use cases include: e-commerce product image batch background removal (white / transparent), portrait photo background replacement, AI training data preprocessing (target mask annotation), AIGC secondary editing (compositing), and designer material processing. Hardware floor: runs on CPU via ONNX Runtime, GPU (CUDA / CoreML) is 3-5x faster; single 1024x1024 image peaks at ~2GB memory. Onboarding: pip install rembg[cli] → rembg i photo.jpg out.png; Python embed per README examples; Docker image available.
Licensed under MIT (most permissive), allows commercial closed-source use, modification, and redistribution with only copyright notice retained. Positioning versus VisLane's already-listed backgroundremover (same-purpose, same-scoped library): backgroundremover is the nadermx-maintained early U²-Net wrapper (since 2018), while rembg is a more modern, more models, more active alternative with tighter ComfyUI node ecosystem. If you're already using backgroundremover, migration to rembg is usually a one-line import swap; if first time, just start with rembg (more actively maintained, broader model coverage).
Workflow stage
Quick Start
Deployment guides and docs are linked externally to stay up to date.