npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jackgreen2018/browser-background-remover

v1.0.1

Published

Browser-based background removal using pre-built WASM. No server uploads, no subscriptions, privacy by design. Free alternative to Remove.bg for Etsy/Shopify sellers.

Readme

@jackgreen2018/browser-background-remover

Browser-based background removal using pre-built WASM. No server uploads, no subscriptions, privacy by design.

Built for Etsy and Shopify sellers who process 10–50 product photos monthly and resent Remove.bg's $7.99/mo subscription.

Install

npm install @jackgreen2018/browser-background-remover

Usage

import { removeBackground } from '@jackgreen2018/browser-background-remover';

// From raw bytes
const result = await removeBackground(arrayBuffer, {
  threshold: 0.5,   // 0.0–1.0, lower = more conservative
  blurRadius: 2,    // Gaussian blur for soft edges
});

// result.imageData: Uint8Array of PNG bytes with transparent background
// result.alphaMap: Uint8Array of alpha values [0–255] per pixel
// result.width, result.height: output dimensions

// From a File object (browser)
const file = document.querySelector('input[type=file]').files[0];
const result2 = await removeBackgroundFromFile(file, { threshold: 0.4 });

API

removeBackground(input, options?)

Remove background from an image.

  • input: ArrayBuffer | Blob — the source image (JPEG or PNG)
  • options.threshold: 0.0–1.0 (default: 0.5) — sensitivity for background detection
  • options.blurRadius: number (default: 2) — Gaussian blur radius for edge softening
  • returns: Promise<BackgroundRemovalResult> with imageData, alphaMap, width, height

removeBackgroundFromFile(file, options?)

Convenience wrapper for browser File objects.

Benchmark

Measured on Node.js 22, 5 iterations each, real numbers:

| Image Size | Avg (ms) | Min (ms) | Max (ms) | |---------------|----------|----------|----------| | 100x100px | 4.55 | 2.95 | 10.70 | | 500x500px | 65.39 | 62.88 | 67.75 | | 800x600px | 121.72 | 117.61 | 135.64 | | 1000x1000px | 249.47 | 244.03 | 257.12 |

Comparison: Remove.bg API takes ~2–5 seconds per image (server round-trip + processing). This library runs entirely in-browser at ~5–250ms depending on image size.

How It Works

  1. WASM decode — Pre-built WebAssembly module decodes JPEG/PNG input
  2. Background estimation — Samples corner pixels to estimate background color
  3. Alpha matte — Builds a soft matte via color-distance thresholding
  4. Edge softening — Applies Gaussian blur to smooth transitions
  5. PNG encode — Outputs transparent PNG

The WASM binary is pre-built and included in the package. No compilation required.

License

MIT