Skip to main content

bgeraser

Remove image backgrounds on your own computer. No uploads, no API keys, no watermarks, no limits.

Works three ways:

Command line bgeraser photo.jpg → photo-nobg.png
Python library remove_background("photo.jpg")
Local web page bgeraser serve → drag & drop in your browser

Powered by open-source U²-Net / ISNet models through rembg.

Install

pip install bgeraser            # CLI + library
pip install "bgeraser[web]"     # also the drag & drop web page

Needs Python 3.9+. The first run downloads the model (4 MB for the default u2netp; larger models download when you choose them).

Command line

# one image → transparent PNG next to it
bgeraser photo.jpg

# choose the output name
bgeraser photo.jpg -o clean.png

# solid background instead of transparent (product photos, ID photos)
bgeraser photo.jpg --bg white
bgeraser photo.jpg --bg "#00ff00"

# a whole folder → ./products/nobg/
bgeraser ./products
bgeraser ./products -o ./out --recursive

# better model for people
bgeraser --model u2net_human_seg me.png

# finer edges for hair / fur (slower)
bgeraser photo.jpg --matting

# list models
bgeraser models

Web page (drag & drop)

bgeraser serve

Then open http://127.0.0.1:5000. Drop, paste, or pick an image; download the PNG. Everything stays on your machine.

bgeraser serve --port 8080 --model isnet-general-use to change port or model.

Python

from bgeraser import remove_background, remove_background_bytes, process_folder

remove_background("photo.jpg")                           # -> photo-nobg.png
remove_background("photo.jpg", "out.png", bg_color="white")
remove_background("photo.jpg", model="isnet-general-use", alpha_matting=True)

png_bytes = remove_background_bytes(open("photo.jpg", "rb").read())   # in-memory

process_folder("./products", "./products/out")           # batch

Models

name best for
u2netp (default) fast, small, everyday use
u2net general, higher quality
isnet-general-use often the cleanest edges
u2net_human_seg people / portraits
isnet-anime anime & illustrations
u2net_cloth_seg clothing segmentation
silueta u2net quality, smaller file

Why

Online background removers are slow, watermark the result, charge per image, or make you upload customer photos to a stranger's server. This does the same job offline, for free, in one command.

Contributing

Issues and pull requests welcome. Run tests with:

pip install -e ".[dev]"
pytest

License

MIT © Tavrej / Yonzon Studio

Metadata

Release files for bgeraser 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bgeraser 0.1.0
File Size Uploaded
bgeraser-0.1.0.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bgeraser 0.1.0
File Interpreter ABI Platform
bgeraser-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / bgeraser-0.1.0.tar.gz

Download URL bgeraser-0.1.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
38d8f49d2c75e9a2f7b72be4092937548b9a3467807f4ff5a2440e4952f743fe
BLAKE2b-256 checksum
How to use checksums
df34af502eb3ff70821229c5cbff0c90bdab5ac2343be00382affdce5cf45b5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / bgeraser-0.1.0-py3-none-any.whl

Download URL bgeraser-0.1.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09a8c8c67afded8519a487b72a7572046ad3f03b0dcb75c3eef0dd474ee8f53a
BLAKE2b-256 checksum
How to use checksums
a44c040fe448641cd809804230c000fe924f0b856da90252ce58c23974ee8d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page