Repository navigation
v1.0.0 — Hybrid WebGPU Proxy + Euclidean RGB Color-Key Alpha Matting Kernel
Initial public release of browser-alpha-matting (v1.0.0) — a zero-dependency JavaScript/TypeScript alpha-matting and mask-refinement kernel for 100% client-side browser background removal.
Exported Functions
-
extractColorKeyAlpha(rgba, width, height, options)—$O(W \cdot H)$ 3D Euclidean RGB distance color-keying with anti-aliased tolerance/softness ramp. -
fuseHybridAlpha(neuralAlpha, colorKeyAlpha, options)—$O(W \cdot H)$ hybrid fusion preserving soft neural hair/fur contours while carving enclosed typographic counters (O,A,B,P). -
upsampleAlphaBilinear(proxyAlpha, proxyW, proxyH, targetW, targetH)— PureTypedArraybilinear upsampling from1024pxneural proxy masks back to native4Kdimensions. -
shiftAlphaBoundary(alpha, width, height, shiftPx)— Two-pass separable 1D morphological erosion (shiftPx < 0) and dilation (shiftPx > 0). -
featherAlphaSeparable(alpha, width, height, radiusPx)—$O(W \cdot H)$ two-pass sliding-accumulator tent feathering independent ofradiusPx. -
decontaminateForegroundColors(rgba, alpha, width, height, passes)— Propagates opaque foreground RGB outward into semi-transparent boundary pixels to eliminate edge halos. -
compositeNativeResolution(rgba, width, height, alpha, backdropRgb)— Lossless 32-bit transparent RGBA export or solid RGB backdrop flattening. -
createMattingWorkerBridge(workerUrl)— Zero-copyTransferableArrayBufferWeb Worker IPC wrapper for off-main-thread WebGPU/WASM inference.
Live Production Sandbox
Test the full hybrid WebGPU + Color-Key pipeline in the browser at https://utilvo.com/background-remover