Skip to content

Runs in the browser · Vision

Run RMBG-1.4 in your browser

RMBG-1.4 downloads 84.1 MB over WebGPU (fp16), or 42.3 MB over WebAssembly (q8), to process an image entirely in the tab with Transformers.js. No install, no server.

Vision · briaai/RMBG-1.4

WebGPU download
84.1 MB
fp16
WASM download
42.3 MB
q8
Parameters
44.1M
Pipeline task
custom

Reading

The repo's config declares a custom architecture, so there is no working pipeline() call for this model; use the AutoModel flow shown in the snippet (the same one the official remove-background demo ships).

The WASM build downloads smaller here: 42.3 MB (q8) against 84.1 MB (fp16) for WebGPU. The CPU-fallback quant compresses tighter than the GPU pick for this model.

The quant ladder spans 4.0x: 42.3 MB (q8) to 168.0 MB (fp32).

Run it in your browser

Live run this browser

Checking what this browser can run…

All measured variants

Quant Download size
Variant Size
q8 WASM pick 42.3 MB
fp16 WebGPU pick 84.1 MB
fp32 168.0 MB

Sizes measured from the HuggingFace API file tree for briaai/RMBG-1.4, not estimated.

Use it with Transformers.js

import { AutoModel, AutoProcessor, RawImage } from "@huggingface/transformers";

// RMBG-1.4's config uses a custom architecture string, so pipeline() rejects
// it; load it as a custom model with an explicit processor config instead
// (this mirrors the official remove-background-web demo).
const model = await AutoModel.from_pretrained("briaai/RMBG-1.4", {
  config: { model_type: "custom" },
  device: "webgpu", // or "wasm"
  dtype: "fp16", // use "q8" for the WASM build
});
const processor = await AutoProcessor.from_pretrained("briaai/RMBG-1.4", {
  config: {
    do_normalize: true, do_pad: false, do_rescale: true, do_resize: true,
    image_mean: [0.5, 0.5, 0.5], image_std: [1, 1, 1],
    feature_extractor_type: "ImageFeatureExtractor",
    resample: 2, rescale_factor: 1 / 255, size: { width: 1024, height: 1024 },
  },
});

const image = await RawImage.fromURL("https://your-image-url.jpg");
const { pixel_values } = await processor(image);
const { output } = await model({ input: pixel_values });
// output[0] is the alpha mask; resize it to the source and composite.
const mask = await RawImage.fromTensor(output[0].mul(255).to("uint8"))
  .resize(image.width, image.height);

Requires npm install @huggingface/transformers (or the CDN build). This model needs the lower-level API shown above, not pipeline() (see the Reading panel above).

Sources

Same job, different size

FAQ

WebGPU or WASM for RMBG-1.4, in practice?

Chrome, Edge, and Safari 26+ run the WebGPU build (fp16) on the GPU. Firefox has WebGPU on Windows and Apple Silicon Macs but not everywhere yet. Any browser without a WebGPU adapter falls back automatically to the WebAssembly build (q8) on CPU: same model, slower to load, slower to run.

What does fp16 mean for RMBG-1.4?

The WebGPU build here uses fp16: 16-bit floating point (half precision): smaller than fp32 with effectively no quality loss. The WASM fallback uses q8: 8-bit integers: about a quarter the size of fp32, with a smaller quality trade than 4-bit.

Sizes measured 2026-08-01 from the HuggingFace API. Last validated 2026-08-03. See all browser models or the methodology.