Practical overview
When it fits
Use the SDK when background removal needs to sit inside Python code or a CLI workflow. Choose local mode for offline or private processing and batches; choose the Cloud API when avoiding local model setup or seeking the README's stated improvement on hair and fur edges.
Who it is for
- Python developers adding background removal to image-processing pipelines.
- Teams preparing product images or processing batches locally.
- Developers who prefer an API-backed integration for occasional use or product workflows.
Documented uses
- Remove a background from an image and save a transparent PNG or WebP.
- Process multiple images in a Python batch workflow while keeping a local model loaded.
- Choose between local CPU-based ONNX processing and a cloud API for image cutouts.
- Use a command-line interface to process a single image.
Requirements & limits
The README describes local open-weight processing as free and the Cloud API as pay per image. Local setup downloads about 1.5 GB of weights on first use; Cloud mode requires an API key.
- Local mode uses CPU ONNX and does not require a GPU; the first run downloads about 1.5 GB of weights.
- Cloud mode requires an API key and sends images to the API; the README describes it as better for hair and fur edges.
- The SDK returns PIL images in RGBA mode; PNG and WebP preserve transparency, while JPEG drops it.
- For batch processing, the README advises loading the model once rather than recreating it for each image.
- The repository README displays an Apache 2.0 license badge.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Remove one image background locally in Python
Install the package, process an input image with local open weights, and save a transparent PNG.
Before you start
- Python package manager uv.
- The withoutbg Python package.
- About 1.5 GB for the first local model-weight download from Hugging Face.
Steps
Install the package with the command below.
uv add withoutbgCreate a model with
WithoutBG.open_weights().Pass an image path to
model.remove_background()and save the returned image as PNG.
Expected outcome
A PIL image in RGBA mode is saved as a PNG with transparency.
Guide limitations
- The first local run downloads about 1.5 GB of weights; the BiRefNet branch is fetched the first time an image needs it.
- JPEG drops transparency silently; use PNG or WebP to preserve it.
- The README states that local processing can run on CPU without a GPU.
Remove an image background with the Cloud API
Configure the SDK with an API key and save the processed image as PNG.
Before you start
- The withoutbg Python package.
- A withoutBG Cloud API key, passed as
api_keyor set asWITHOUTBG_API_KEY.
Steps
Create a model with
WithoutBG.api(api_key="..."), or configureWITHOUTBG_API_KEY.Pass the input image path to
model.remove_background().Save the returned image as PNG to retain transparency.
Expected outcome
A processed PIL image in RGBA mode is saved as a transparent PNG.
Guide limitations
- Cloud mode sends the image to the API.
- The README describes Cloud API use as pay per image.
- JPEG drops transparency silently.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 17 October 2026
- Original website title
- withoutbg/withoutbg-python · Official homepage title · retained in its source language
Related options
withoutBG Docker/self-host — A separate project surface described in the README for running an HTTP API or browser UI on a server; the Python SDK is the in-process option.

