Skip to content
ufraan
← Back

rmbg

Local background removal for images using BRIA RMBG 2.0 on Apple Silicon - no uploads, no accounts.

PythonMachine LearningCLI
Sep 2026GitHub

A command line tool that strips the background out of an image. Most background removers are websites that want your photo, an account, and a subscription; this one runs the model on your own machine and never moves the file off your disk. It uses BRIA RMBG 2.0, the BiRefNet architecture, running on Apple Silicon through PyTorch MPS.

Trace visualization showing service calls
Trace visualization showing service calls

Give it a file and it writes a transparent PNG beside it. Passing a directory processes the whole folder in batch mode, and flags cover a custom output path, an output folder, replacing the original, or opening the result in Preview straight away.

The pipeline is the standard one for this kind of model: load the weights, preprocess the image down to 1024 by 1024, run inference on MPS, CUDA or plain CPU, generate the alpha mask, and composite a transparent PNG out of it. It takes roughly one to three seconds per image on an M-series chip, and the model weights, around 900MB, are cached after the first run.

Written because I wanted to cut out backgrounds for a project without handing images to a third-party API.