withoutBG
Open-source Python SDK for background removal. Run ONNX weights locally for free, or switch to the paid Cloud API with one line of code.
What is withoutBG?
withoutBG is an open-source Python SDK for image background removal. The same remove_background() call works in two modes:
- Local (
open_weights()) — Downloads ~455 MB of open ONNX weights from Hugging Face once, then runs everything on your CPU. Free, offline, private, unlimited usage. - Cloud (
api()) — Calls the withoutBG Cloud API, which uses a larger proprietary model for sharper edges on hair and fur. Pay per image, no GPU needed.
Key features
- One API, two backends — Local and Cloud use the same method signature. Switch with a one-line code change.
- CPU-friendly ONNX model — No GPU required for local inference; runs on any laptop.
- Batch processing —
remove_background_batch()loads the model once and reuses it across thousands of images, which is the recommended pattern for pipelines. - CLI included —
withoutbg photo.jpgworks out of the box for shell scripts. - PIL Image output — Returns RGBA
PIL.Imageobjects, so compositing withPIL.Image.paste(fg, (0,0), fg)is a one-liner. - Hugging Face weights — The ONNX model is published openly, so you can host it behind your own inference server, fine-tune downstream, or inspect it.
- Progress callbacks — For long batch jobs, pass a callable to receive 0.0–1.0 progress updates.
How it compares to remove.bg and PhotoRoom
remove.bg is the canonical paid background-removal API. withoutBG's local mode gives you the same core capability (image cutout) for free, with no per-image cost and no image leaving your machine. The Cloud mode is the direct competitor for users who want remove.bg's quality without managing a remove.bg account.
PhotoRoom wraps background removal in a full product-photo editor with templates and team workspaces. withoutBG is a developer SDK rather than a polished GUI app, so it fits better into scripts, backends, batch jobs, and notebooks. The same company also ships a Mac app, Docker inference server, and GIMP plugin on top of the same open weights if you want a UI.
Privacy and licensing
The local model is Apache-2.0 licensed and runs entirely on your hardware. Cloud mode sends the image to withoutBG's servers, so use local mode for sensitive or regulated workloads.
Install
uv add withoutbg
or pip install withoutbg.


withoutBG vs SnapOtter