AI Explained

How AI Background Removal Works: Segmentation, Matting and Edge Quality

In one sentence: a background remover is a neural network that predicts, for every pixel of the photo, how much it belongs to the subject — and then writes that prediction into an alpha channel that compositing software can read. Everything else is engineering. This article walks through the three pipeline stages, explains why hair and glass are hard, and shows what changes when the network runs on your device instead of on a company's server — which is how Tatovio works.

Stage 1 — Segmentation: deciding what the subject is

The first stage answers the question "which pixels are the subject?". Modern background removers use salient object segmentation networks trained on millions of annotated images. The model encodes the photo into visual features, then decodes a probability map — essentially a heatmap where 1 means "definitely subject" and 0 means "definitely background". Tatovio's default engine, BRIA RMBG-1.4, is exactly this kind of model, executed via Transformers.js v3 on ONNX Runtime Web. Segmentation answers what, but a binary map produces hard edges — which is why a second stage exists.

Stage 2 — Alpha matting: the soft edge layer

Real edges are not binary. A strand of hair is a mix of subject and background; the glass of a perfume bottle is mostly background showing through. Alpha matting assigns each boundary pixel a fractional opacity between 0 and 1 instead of a yes/no verdict. This fractional alpha is what later lets a cutout sit on any new background without a hard cut-line. Tatovio's second engine, IMG.LY ISNet (FP16), specialises in these soft matte edges — it is the engine to pick for portraits with flyaway hair, furry products, or semi-transparent glass and liquids.

Rule of thumb: RMBG-1.4 for speed and general products; ISNet when edges, hair or transparency dominate the image. Switching engines is a dropdown click — the photo never leaves the device either way.

Stage 3 — Compositing: putting the subject somewhere new

The cutout is only useful once it is composited: the alpha map multiplies the subject's pixels, and the result is drawn over a new canvas — transparent (a PNG with a real alpha channel), pure white (#FFFFFF for marketplace main images), a colour, a photo, or a painted studio scene. Quality at this stage is geometry, not AI: the subject must be grounded (touching the surface it is supposed to stand on), and any shadow or reflection must follow the actual silhouette. That is why Tatovio computes contact shadows and mirror reflections from the cutout's own shape rather than stamping a generic ellipse under it.

StageWhat it decidesWhere it goes wrong
SegmentationWhich pixels belong to the subjectLow contrast between subject and background; multiple overlapping objects
Alpha mattingHow transparent each edge pixel isHair strands, fur, glass, motion blur
CompositingWhere the subject sits in the new sceneFloating products, wrong shadow direction, mismatched perspective

Why running the model locally changes everything

Most online background removers upload your photo to a server, run a GPU model there, and send the result back. That design has three costs: a privacy exposure (your photos live on someone else's infrastructure), a per-image pricing model (servers and GPUs are expensive), and latency on every single cutout. Running the same class of networks in the browser — via WebAssembly and ONNX Runtime Web — inverts all three: photos never leave the device, there is no per-image server cost (which is why Tatovio can be genuinely free with no watermark), and after the model is cached, cutouts work offline. The trade-off is honest: the first session downloads the model weights, and very old browsers without WebAssembly support cannot run the local engines at all.

Where AI still struggles (and the manual fix)

Five terms, plainly defined

Keep reading

Tutorial

Remove Backgrounds from Product Photos in 4 Steps

Apply the pipeline: cutout, scene, shadow, marketplace export.

Buying Guide

How to Choose a Free Background Remover

Seven criteria, including where the processing actually happens.

Marketplaces

White Background Requirements by Marketplace

What Amazon, eBay and Etsy expect from a main listing image.