ai
3 мин
11 октября 2026 г.
Источник: Dev.to AI Feed

How a Background Remover Can Run 100% in Your Browser

SAHU Khan
SAHU Khan
RSS AI Ingest
How a Background Remover Can Run 100% in Your Browser

A few years ago, removing a photo's background meant uploading it to some server, waiting in a queue, and hoping the service didn't keep a copy. Today you can open a web page, drop in a photo, and get a clean cutout in seconds — with your f...

A few years ago, removing a photo's background meant uploading it to some server, waiting in a queue, and hoping the service didn't keep a copy. Today you can open a web page, drop in a photo, and get a clean cutout in seconds — with your file never leaving your device. Here's how that works under the hood. It starts with a segmentation model Background removal is an image segmentation problem: for every pixel, the model decides "foreground" or "background". Researchers trained convolutional neural networks on thousands of labeled portraits and product shots until they got very good at finding edges — hair, fur, transparent glass, the hard cases. The trick that brought this to the browser was making those models small and portable. Models are exported to formats like ONNX, quantized down, and compiled to run on WebAssembly or WebGPU. What used to need a GPU server now runs on your laptop's CPU or integrated graphics in a couple of seconds. What actually happens when you drop in a photo Decode locally. The browser reads your image with the Canvas API or createImageBitmap — no upload involved. Run inference. The quantized model processes the image tensor right in the page (often via onnxruntime-web), producing an alpha mask. Refine the mask. A bit of feathering/edge smoothing cleans up halos around hair. Composite and export. The foreground is drawn onto a transparent canvas and exported as PNG — all client-side. Why "in the browser" is a bigger deal than it sounds Privacy. Personal photos, ID documents, product shots for an unreleased launch — nothing traverses the network. No queues or accounts. There's no server capacity to ration, so there's nothing to sign up for. Offline after first load. Once the page and model weights are cached, it can even work with flaky connectivity. Try it yourself If you want to see it in action, Napizo's free background remover does exactly this: open the page, drop in a JPG or PNG, and download the transparent PNG. Because the model runs in your browser, there's no upload, no sign-up, and no watermark — your file never leaves your device. The broader lesson: the browser has quietly become a serious compute platform. When the model fits in a few megabytes of WASM, "AI-powered" stops meaning "send your data to our cloud" — and that's a win for users and developers alike.

Хотите внедрить ИИ в ваш бренд?

Спроектируем и развернем автономных агентов и современный цифровой стек под ваши задачи.

Рассчитать проект