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 🙏

© 2025 – Pkg Stats / Ryan Hefner

picsquish

v0.3.0

Published

Modern image resizer for browser

Readme

picsquish - modern image resizer for browser

NPM version

demo

Rewrite of pica

This project aims to be a modern rewrite of pica featuring:

  • all ESM
  • all TypeScript
  • easy to follow code
  • improved performance

Purpose

This project is aimed for resizing images within the browser so that no external service is needed. The resize result from this project is an improvement on the result that would be given from the browser's Canvas API, for it features more detail, less artifacts/pixelation, and the computation is offloaded from the main thread.

Usage Examples

import { squish, type Options as SquishOptions } from 'picsquish'

// you can get a single resized image with one input image
const single = await squish(inputImage, 400)
const resizedBlob = await single.toBlob()

// you can get multiple resized images with one input image
const multi = squish(inputImage, [400, 600, 800])
multi.forEach(p => p.then(r => r.toBlob()))

// you can override the default configuration by specifying your own options
const options: SquishOptions = { maxWorkerIdleTime: 1000, maxWorkerPoolSize: 6 }
const custom = await squish(inputImage, 400, options)

API

The API is open for suggestions for 1.0.0 release

// result can be a single Promise<SquishResult> or an array of them (depending on dimensionLimits)
const result = squish(image, dimensionLimits, options)
  • image - can be a Blob or ImageBitmap
  • dimensionLimits - can be a single input or an array specifying the dimension limit(s) for each resized image
  • options - options are not required and defaults are provided for those not specified
    • useMainThread - if (for some reason) you want to resize on the main thread and not use web workers
    • maxWorkerPoolSize - the max amount of web workers to allocate for resizing
    • maxWorkerIdleTime - the max amount of idle time before web workers terminate
    • tileSize - the target width and height of each tile for processing
    • filter - box | hamming | lanczos2 | lanczos3 | mks2013
    • unsharpAmount - (from pica): >=0. Default = 0 (off). Usually value between 100 to 200 is good. Note, mks2013 filter already does optimal sharpening.
    • unsharpRadius - (from pica): 0.5..2.0. Radius of Gaussian blur. If it is less than 0.5, Unsharp Mask is off. Big values are clamped to 2.0.
    • unsharpThreshold - (from pica): 0..255. Default = 0. Threshold for applying unsharp mask.

For more context regarding options and intention you can refer to pica

  • SquishResult - the result the squish promise resolves to
    • raw - result Uint8ClampedArray<ArrayBuffer>
    • width - result width number
    • height - result height number
    • toImageData - turns result into ImageData
    • toImageBitmap - turns result into ImageBitmap
    • toCanvas - turns result into HTMLCanvasElement
    • toBlob - turns result into Blob

Local Development

To develop locally you only need bun

bun install
bun run build
bun run demo

Firefox Bug

There is a bug in Firefox regarding createImageBitmap() that causes images to be decoded on the main thread (this is blocking and causes visual stutters). This affects both pica and picsquish.