Python background removal when you outgrow a single local script#

Many teams start with a small Python script and a popular open model. That works until you need consistent product edges, a local HTTP API for editors, or a managed path without rewriting the client.

When this applies#

  • You already automate cutouts in Python and want a maintained package
  • You need both local open weights and a cloud upgrade in one SDK
  • You want Docker or Mac Local API with the same HTTP contract as cloud
  • You are comparing open models on real photos, not only demos

Which path to use#

If you…Use
Offline / private / unlimited localpip install withoutbg + open_weights()
Hair, fur, product edgesWithoutBG.api() (Pro Model API)
Choosing among rembg session modelsOpen Model Hub → rembg models directory
Quality vs u2net-class open modelsOpen Model vs u2net compare
Quality vs hosted remove.bgremove.bg alternatives (Open, Pro and open models)

How withoutBG fits#

  • Official package: uv add withoutbg or pip install withoutbg.
  • Local mode downloads Open Weights once (~495MB) and runs on CPU ONNX. No API key.
  • Cloud mode uses the same remove_background call with an API key or WITHOUTBG_API_KEY.
  • For editor workflows, pair Python or Docker with the GIMP plugin against 127.0.0.1:8000.
  • rembg is a runtime with many sessions (u2net, IS-Net, BiRefNet, …) — see the rembg models hub for cards and visual compares.

Local options compared#

Alpha-matte error on Bench v0 (60 real photos, ground-truth mattes, 1024 px shorter side). Lower is better. withoutBG models route each image to a matting model or to BiRefNet; see the benchmark for the split.

OptionLicenseMAEMGERun
withoutBG Pro Model Self-HostCommercial self-host license (commercial license)0.0280.037Docker image (commercial license)
withoutBG Open WeightsApache-2.0 (open weights)0.0290.045pip install withoutbg
BiRefNet GeneralMIT (open weights)0.0430.049rembg i -m birefnet-general in.jpg out.png
BiRefNet General LiteMIT (open weights)0.0520.054rembg i -m birefnet-general-lite in.jpg out.png
BiRefNet DISMIT (open weights)0.0570.058rembg i -m birefnet-dis in.jpg out.png
BiRefNet MassiveMIT (open weights)0.0710.056rembg i -m birefnet-massive in.jpg out.png
BiRefNet PortraitMIT (open weights)0.0710.065rembg i -m birefnet-portrait in.jpg out.png
IS-NetApache-2.0 (open weights)0.0940.061rembg i -m isnet-general-use in.jpg out.png
BiRefNet HRSODMIT (open weights)0.1070.071rembg i -m birefnet-hrsod in.jpg out.png
U²-NetApache-2.0 (open weights)0.1280.080rembg i -m u2net in.jpg out.png
SiluetaApache-2.0 (open weights)0.1340.085rembg i -m silueta in.jpg out.png
U²-NetPApache-2.0 (open weights)0.1400.080rembg i -m u2netp in.jpg out.png

Python (open weights, runs locally)

pip install withoutbg

from withoutbg import WithoutBG

model = WithoutBG.open_weights()
model.remove_background("input.jpg").save("output.png")

FAQ#

Is this a drop-in replacement for every open Python tool?#

APIs differ. Expect a short migration: install withoutbg, choose open_weights or api, call remove_background. See the Python docs for examples.

Can I keep processing local?#

Yes. open_weights() never sends images to withoutBG servers. Switch to api() only when you want Pro quality.

How does quality compare to u2net-based stacks?#

See the Open Model vs u2net side-by-side page for alpha mattes on the same photos. Pro is a further step up on hard edges. For the full rembg catalog, open the rembg models hub.

Where do I start?#

Python docs for install and batch examples, Open Model hub for the full surface area (Docker, Mac, GIMP).

How does withoutBG Open Weights score against u2net and other rembg sessions?#

Bench v0 scores 60 real photos against ground-truth alpha mattes at a 1024 px shorter side; lower is better. withoutBG Open Weights MAE 0.029, MGE 0.045; U²-Net MAE 0.128, MGE 0.080; U²-NetP MAE 0.140, MGE 0.080; IS-Net MAE 0.094, MGE 0.061; BiRefNet General MAE 0.043, MGE 0.049. The lowest MAE among the rembg sessions is BiRefNet General at 0.043. withoutBG Open Weights routes each image to a matting model or to BiRefNet, so part of its score is BiRefNet output; see the benchmark page for the split.

Next steps#

Pick an entrypoint. All product paths are linked from the use cases hub.