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

@dusrel/image-resize

v1.0.1

Published

High-quality resizing (Rust resize/hqx/magic-kernel, WASM).

Readme

@dusrel/image-resize

High-quality image resampling for the @dusrel/image family, powered by the Rust resize crate compiled to WebAssembly — the same engine family Squoosh and jSquash use. The Canvas fast path in @dusrel/image-core stays the default; this package is the quality path you opt into when pixels matter (thumbnails, avatars, print exports).

npm install @dusrel/image-resize
import { resize } from '@dusrel/image-resize';

const thumb = await resize(imageData, { width: 320, height: 240, filter: 'lanczos3' });

API

| Export | What it does | | --- | --- | | resize(ImageData, options) | Resample to width×height, returns a new ImageData | | init() | Preload the WASM module | | setCodecAssets({...}) | Override asset URLs (CDN hosting, tests) | | resolveOptions(options) | The validated options with defaults applied |

Options

| Option | Values | Default | | --- | --- | --- | | width / height | positive integers | (required) | | filter | 'nearest' \| 'triangle' \| 'catmull-rom' \| 'mitchell' \| 'bspline' \| 'gaussian' \| 'lanczos3' | 'lanczos3' | | alpha | 'premultiplied' \| 'straight' | 'premultiplied' |

Alpha, handled correctly

ImageData stores straight (unpremultiplied) alpha. Resampling straight-alpha pixels directly lets the RGB of fully transparent pixels bleed into visible edges (a red photo edge next to transparent-green padding turns muddy). With the default alpha: 'premultiplied' the module premultiplies, resamples via the crate's premultiplied format, then unpremultiplies — verified in tests: the boundary stays pure red as it fades. Use alpha: 'straight' only for non-colour data (masks, depth maps).

Honest scope

  • hqx is not included. The resize crate has no hqx implementation; it is tracked as future work in docs/CODEC_GUIDE.md rather than promised here. For pixel art, 'nearest' is the correct v1 choice.
  • Module size as committed: codec/resize.wasm 161,317 B.

Provenance

Built reproducibly from native/rust (pinned rust:1.99.1 + wasm-bindgen 0.2.130, resize = 0.8.9) by the repo's wasm-build workflow; the Docker build ends with a functional smoke gate (exact nearest blocks, stable lanczos solid). Verified again in Chromium, Firefox and WebKit by tests/browser/resize.spec.ts.

Licences: this package MIT; resize and rgb crates MIT (see the repo's THIRD_PARTY_LICENSES.md).