withoutBG is a Python package to remove image backgrounds locally with open weights or via a cloud API. It returns RGBA images for scripts, notebooks, batches, and CLI use.
Overview
withoutBG provides background removal for Python workflows through one API that can run fully on your machine or call a hosted service. Local open-weights mode uses ONNX models without requiring a GPU by default, keeps images private, and can run offline after weights download. Cloud API mode sends images for higher edge quality on hair, fur, and fine detail at per-image cost.
Core methods return PIL images in RGBA. Batch processing reuses a single loaded model for efficiency. A smart brush edit path accepts keep and remove masks to refine mattes locally with a small stroke-edit network, with similar stroke input available through the API. A command-line interface mirrors single-image and batch flows for both modes.
The open-weights bundle routes each image to either a matting branch or a segmentation branch before upscaling alpha to native resolution. Optional NVIDIA CUDA acceleration swaps ONNX Runtime providers in memory. Environment variables configure API keys and local model paths for air-gapped or CI setups.
The package is the in-process embedding of withoutBG technology; related surfaces mentioned include a Mac desktop app and standalone cloud API for teams that do not want to run inference themselves.
Key features
- Local ONNX open-weights inference
- Optional cloud API for higher quality
- PIL RGBA output and batch helpers
- Smart brush mask refinement
- CLI for local and API modes
- Progress callbacks on processing
- Optional CUDA acceleration
- Environment-based API key config
Use cases
- Batch product photo cutouts
- Private offline background removal
- Notebook and script automation
- Refining mattes with brush masks
- Compositing subjects onto new backgrounds