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

wasm-image-processor

v0.6.0

Published

High-performance client-side image processing toolkit powered by Rust and WebAssembly

Downloads

9

Readme

WASM Image Processor

High-performance client-side image processing powered by Rust and WebAssembly

Process images entirely in the browser with near-native performance. No server uploads, works offline, respects user privacy.

Live Demo | Full Documentation | npm Package


Quick Start

For JavaScript Users

npm install wasm-image-processor

Vite users: Install vite-plugin-wasm and add it to your config (see setup guide)

import { resize_square, blur, grayscale } from "wasm-image-processor";

// Resize an image to 512x512
const resizedBytes = resize_square(imageUint8Array, 512);

// Apply Gaussian blur
const blurredBytes = blur(imageUint8Array, 5.0);

// Convert to grayscale
const grayBytes = grayscale(imageUint8Array);

Key features:

  • Auto-initializes WASM (no manual setup)
  • ~150KB gzipped bundle size
  • TypeScript types included
  • Supports PNG and JPEG formats
  • See complete documentation for all functions

For Rust Contributors

Project structure:

src/
  lib.rs          # WASM bindings & public API
  processing/     # Core image processing logic
  utils/          # Helpers
Cargo.toml

Local development:

# Build for web
wasm-pack build --target web --out-dir pkg

# Run tests
cargo test
wasm-pack test --headless --firefox

# Test in browser
cd example && npm install && npm run dev

Key dependencies:

  • image = "0.24" for core processing
  • wasm-bindgen = "0.2" for JS interop
  • Safe Rust only, panic-safe for WASM context

Contributing: Fork the repo, create a feature branch, and open a PR. See documentation repo for docs contributions.


Available Functions

Core Operations:

  • resize_square(bytes, size) - Resize to square dimensions
  • resize(bytes, width, height) - Resize to custom dimensions
  • crop(bytes, x, y, width, height) - Crop to region
  • thumbnail(bytes, width, height) - Generate thumbnail

Filters & Adjustments:

  • blur(bytes, sigma) - Gaussian blur
  • fast_blur(bytes, sigma) - Optimized blur
  • contrast(bytes, value) - Adjust contrast (-100 to 100)
  • brighten(bytes, value) - Adjust brightness (-100 to 100)
  • grayscale(bytes) - Convert to grayscale
  • invert(bytes) - Invert colors
  • hue_rotate(bytes, degrees) - Rotate hue (0-360)

Coming Soon:

  • rotate(bytes, degrees) - Rotate image

See full API documentation with live examples for each function.


Why Use This?

For end users:

  • Privacy: Images never leave your device
  • Speed: Process images in milliseconds
  • Offline: Works without internet connection
  • Universal: Runs in any modern browser

For developers:

  • Rust performance in JavaScript
  • Simple, predictable API
  • Tree-shakeable ES modules
  • No server infrastructure needed

Use Cases

Profile picture editors: Generate multiple sizes for avatars without server round-trips. Resize to 32px, 64px, 128px, 256px instantly in the browser.

Photo galleries & portfolios: Create thumbnails client-side before upload. Apply filters for preview without processing server load.

PWA & offline apps: Process images when users have no internet connection. Perfect for field work apps, travel journals, or offline-first tools.

Privacy-sensitive applications: Medical imaging viewers, legal document processors, or any app where images contain sensitive data that shouldn't touch external servers.

Image compression tools: Build "TinyPNG alternatives" that run entirely in the browser. Users maintain full control of their files.

Batch processing utilities: Resize hundreds of product photos, apply watermarks, or normalize images for e-commerce without server costs or upload time.

Design tools & editors: Add real-time image adjustments (brightness, contrast, blur) to your web app without heavy JavaScript libraries.

Form enhancements: Automatically resize large images before form submission to reduce upload size and improve UX.


Browser Support


Complete Example

<input type="file" id="fileInput" />
<button id="downloadBtn" style="display: none;">Download Processed Image</button>

<script type="module">
  import { resize_square, blur } from "wasm-image-processor";

  const input = document.getElementById("fileInput");
  const downloadBtn = document.getElementById("downloadBtn");

  input.addEventListener("change", async (e) => {
    const file = e.target.files[0];
    if (!file) return;

    try {
      // Read file
      const arrayBuffer = await file.arrayBuffer();
      const uint8Array = new Uint8Array(arrayBuffer);

      // Process: resize and blur
      const resized = resize_square(uint8Array, 512);
      const processed = blur(resized, 2.0);

      // Create downloadable blob
      const blob = new Blob([processed], { type: "image/png" });
      const url = URL.createObjectURL(blob);

      // Setup download
      downloadBtn.style.display = "block";
      downloadBtn.onclick = () => {
        const a = document.createElement("a");
        a.href = url;
        a.download = "processed-image.png";
        a.click();
        URL.revokeObjectURL(url);
      };
    } catch (error) {
      console.error("Processing failed:", error);
    }
  });
</script>

See more examples including Vue, Nuxt, and React patterns.


Performance

Processing happens entirely client-side using WebAssembly, providing:

  • Fast processing with near-native performance
  • Complete privacy - images never uploaded
  • Offline capability
  • Zero server costs

Typical operations:

  • Resize 4K image: ~45ms
  • Apply blur filter: ~30ms
  • Grayscale conversion: ~10ms

Performance varies by device and image size.


Documentation


Common Issues

Import errors: Ensure your bundler supports WebAssembly. Vite users need vite-plugin-wasm installed and configured.

"Failed to read image": Only PNG and JPEG formats are currently supported.

Memory issues: Large images may cause problems on mobile devices. Consider resizing or adding file size limits.

See troubleshooting guide for more help.


Contributing

Contributions welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

For documentation improvements, contribute to the docs repository.


License

MIT License - see LICENSE file for details.


Acknowledgments

Built with:

Questions? Open an issue or check the documentation.