Home / Blog / AI Cutout

@imgly/background-removal in 2026:
Free AI Cutout in the Browser โ€” No Server, No API Key

ISNet ONNX runs locally on WebGPU, WebGL, or WASM. The whole model is 30โ€“150MB. Your photo never leaves the device. Here's exactly how it works, and where to use it free.

๐Ÿ†“ MIT open source ๐Ÿ”’ 100% on-device โšก WebGPU accelerated ๐Ÿ“ฆ ~40โ€“150MB model

01What is @imgly/background-removal?

It's a JavaScript library that runs an ISNet image-segmentation neural network entirely in the browser. You give it a File or Blob, it returns a transparent PNG. No backend, no cloud function, no API key, no per-image cost.

Under the hood it uses ONNX Runtime Web, the same inference engine that powers many production AI products. The model weights are downloaded once, cached by the browser, and reused on every later visit.

๐Ÿ’ก You can try it right now: our free AI Background Remover runs this exact library. Upload a photo, get a transparent PNG in seconds โ€” no sign-up, no watermark.

02The three-line minimum setup

The whole integration is smaller than most npm installs:

import { removeBackground } from "https://cdn.jsdelivr.net/npm/@imgly/[email protected]/+esm"

const file = input.files[0]
const png = await removeBackground(file)
// png is a Blob โ€” download it, show it, whatever

The +esm suffix tells jsDelivr to bundle the ESM module. You don't need a build step, Node, or a package manager. Paste it into a <script type="module"> and it works.

03Model sizes: pick the trade-off

The library ships three ISNet variants. You choose by passing model: 'small' | 'medium' | 'large':

ModelSizeBest forSpeed (old laptop)
small (quantized)~30MBProduct photos, batch jobs, slow networks~4โ€“6 s
medium (balanced)~60MBDefault โ€” portraits, e-commerce~6โ€“9 s
large (best)~150MBFine hair, fur, complex edges~12โ€“20 s

On a machine with WebGPU (any 2023+ GPU), all three finish in under 3 seconds. On CPU-only WASM, expect the numbers above โ€” our AMD Ryzen 5 5500 test box processes a portrait in about 8 seconds on the medium model.

04Automatic hardware fallback

You don't write any GPU detection code. The runtime picks, in order:

  1. WebGPU โ€” fastest, uses the GPU directly. Supported in Chrome 113+, Edge 113+, Safari 26.
  2. WebGL โ€” fallback for older browsers that still have a GPU.
  3. WASM (CPU) โ€” pure software, works everywhere, slowest but always available.

This means a 2018 iPhone and a 2026 workstation both run the same code, automatically.

05More than just transparent PNG

v1.7.0 added output options that most demos don't show. You can control both the file format and what gets exported:

// PNG (transparent) โ€” default
removeBackground(file, {
  output: { format: "image/png", type: "foreground" }
})

// JPEG on a white background (JPEG can't be transparent)
removeBackground(file, {
  output: { format: "image/jpeg", quality: 0.9 }
})

// WebP โ€” smaller file, still transparent
removeBackground(file, {
  output: { format: "image/webp", quality: 0.9 }
})

// Black-and-white alpha mask โ€” for post-processing
removeBackground(file, {
  output: { type: "mask" }
})
FormatTransparentFile sizeUse case
PNGโœ“LargestDesign overlays, stickers
JPGโœ— (white bg)SmallestMarketplaces, eBay, Amazon
WebPโœ“MediumWeb performance, modern browsers
Mask (B/W)โ€”TinyCompositing, color-background swaps
๐Ÿ› ๏ธ We added all of these to our tool: SmartImgKit Background Remover now lets you switch between PNG / JPG / WebP and Cutout / Mask directly in the UI โ€” no code needed.

06Progress feedback users actually see

The library emits progress events so you can show a real loading bar instead of a spinner:

await removeBackground(file, {
  progress: (key, current, total) => {
    if (total === 0) return
    const pct = Math.round((current / total) * 100)
    console.log(`${key}: ${pct}%`)   // download โ†’ load โ†’ run โ†’ postprocess
  }
})

The four stages map naturally to a UX: download the model (only first visit), load it into WASM/WebGPU, run inference, postprocess the alpha mask. On returning visitors, download takes 0ms because the model is already in the browser cache.

07Why this beats remove.bg and other cloud tools

@imgly/background-removalCloud tools (remove.bg etc.)
Cost per imageFree foreverCredits / subscription
Photo leaves deviceNoYes โ€” uploaded to server
API key requiredNoYes
Uptime dependencyNone (after first load)Depends on their service
Batch large imagesUnlimited (local CPU)Rate-limited
Offline after first loadYesNo

With remove.bg shutting down on December 1, 2026, browser-side inference isn't a niche curiosity anymore โ€” it's the most reliable free path forward for e-commerce sellers, designers, and anyone who cares about privacy.

08Known limits (and what's coming)

Try it free, right now

No sign-up. No watermark. Your photo never leaves your browser.

โœ‚๏ธ Open AI Background Remover