Blog

How AI Background Removal Works in Your Browser

Ajjlal AhmedApril 20, 2026background removalAImachine learningISNetONNXWebAssemblyprivacy

How AI Background Removal Works in Your Browser

A few years ago, removing a background from a photo required Photoshop, a steady hand on a selection tool, and considerable patience. Then tools like Remove.bg appeared — server-side AI that could do it in seconds. Now the same quality of AI runs entirely in your browser, with no upload required.

Here's how that works.


The old way: server-side AI

Remove.bg, Canva's background eraser, and similar tools work by sending your image to a server, running an AI model on their hardware, and returning the processed image. It's fast because they run powerful GPUs, but:

  • Your image leaves your device
  • You're limited to their pricing tier (Remove.bg gives 50 free credits/month, then charges)
  • You're dependent on their uptime and API

For personal photos, medical images, or anything commercially sensitive, sending files to a third-party server is a meaningful privacy concession.


The new way: on-device AI via WebAssembly

Modern browsers can run machine learning models locally using two key technologies:

WebAssembly (WASM) — a low-level bytecode format that lets code written in C, C++, or Rust run in the browser at near-native speed. ML frameworks like ONNX Runtime and TensorFlow.js compile to WebAssembly, which is what makes running a neural network inside a browser tab possible.

ONNX Runtime Web — the Open Neural Network Exchange runtime, with a WebAssembly backend. It can load a trained neural network model (a .onnx file) and run inference on it client-side. No GPU required — it runs on the CPU, in the browser, in your tab.

The result: a neural network that would have required a server in 2020 now runs in the browser in 2025.


The model: ISNet

imgshrnk uses ISNet (Highly Accurate Dichotomous Image Segmentation), a state-of-the-art segmentation model developed by researchers at Dalian University of Technology. It was released in 2022 and quickly became one of the most accurate open-source background removal models available.

ISNet works by performing dichotomous image segmentation — it classifies every pixel in your image as either "foreground" (the subject you want to keep) or "background" (everything else). The output is a binary mask with soft edges, which is applied to the original image to produce a transparent PNG.

What makes ISNet good at this:

  • It handles fine detail well — hair, fur, transparent objects
  • It works on complex backgrounds, not just solid colours
  • It produces clean edges without the halo artefacts that simpler models produce

The trade-off is that ISNet is a large model (~20 MB for the full-precision version). imgshrnk offers three variants:

  • ISNet Full Precision — best edge quality, ~20 MB
  • ISNet FP16 — half-precision floating point, ~10 MB, nearly identical quality
  • ISNet Quantized — 8-bit quantization, ~5 MB, fastest, slight quality reduction on complex edges

All three produce a clean result. The quantized version is worth using if you're on a slower connection or want faster processing.


What happens step by step

When you click "Remove Background" on imgshrnk's BG Removal tool:

  1. Model load — the ONNX model file is fetched and cached in your browser (first use only; subsequent uses skip this step)
  2. Pre-processing — your image is resized to 1024×1024 (ISNet's input size), normalised, and converted to a tensor
  3. Inference — ONNX Runtime Web runs the model on your CPU, producing a segmentation mask
  4. Post-processing — the mask is upscaled back to your original image dimensions and applied as an alpha channel
  5. Output — a transparent PNG is returned, ready to download

The entire process happens inside your browser tab. Nothing is sent to any server at any point.


Limitations of browser-based AI

Speed — Without a GPU, inference takes longer. A 1000×1000 pixel image takes 5–20 seconds depending on your CPU. A dedicated server with an NVIDIA A100 does the same in under a second. For single images, the wait is acceptable. For batch processing hundreds of images, a server-side tool is faster.

Edge cases — ISNet handles most subjects well, but struggles with:

  • Hair blending into similar-coloured backgrounds
  • Transparent or reflective objects (glass, water)
  • Extreme close-ups where background and subject colours are nearly identical
  • Very low-resolution images where edge detail is already lost

Memory — Large images (5000×5000+) require significant RAM for inference. Most modern laptops handle this fine, but older devices may struggle.


Why privacy matters here

The practical implication of on-device AI is that your images — product photos, ID documents, personal portraits, confidential materials — never leave your device. There's no request logged on a server, no file stored in a processing queue, no data retained for model training.

For most casual use cases, that's just a nice-to-have. For professionals handling client images, medical photos, or sensitive commercial assets, it's the difference between a tool you can actually use and one your security policy prohibits.


Try it

imgshrnk's Background Removal tool uses ISNet via ONNX Runtime Web, runs entirely in your browser, and produces a transparent PNG with clean edges — free, with no account and no upload limit.

The model loads once and is cached locally. After the first use, it runs instantly.