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

shutterbox

v0.1.1

Published

Image processing pipeline for Next.js.

Readme

shutterbox

Image processing pipeline for Next.js.

Complements next/image with processing capabilities: resize, crop, format conversion, responsive sets, and blur placeholders. Built for AI coding agent ergonomics with a fluent, serializable pipeline API.

Install

npm install shutterbox sharp

sharp is a peer dependency used for actual image processing. The pipeline builder and types work without it.

Quick Start

import { createDarkroom } from "shutterbox";

const darkroom = createDarkroom();

// Build a pipeline (pure data, no sharp needed)
const pipe = darkroom.pipeline()
  .resize({ width: 800 })
  .format("webp")
  .quality(80)
  .toConfig();

// Process an image
const result = await darkroom.process("./photo.jpg", pipe);
// result.buffer, result.format, result.width, result.height, result.size

Pipeline API

The fluent builder produces a serializable array of transforms. No sharp dependency at definition time.

import { pipeline } from "shutterbox";

const config = pipeline()
  .resize({ width: 1200, height: 630, fit: "cover" })
  .crop({ top: 0, left: 0, width: 1200, height: 630 })
  .format("avif")
  .quality(75)
  .blur(2)
  .toConfig();

// config is a plain array — JSON-serializable, storable, transferable
console.log(JSON.stringify(config));

Available Transforms

| Method | Description | |--------|-------------| | .resize({ width?, height?, fit? }) | Resize. Fit: cover, contain, fill, inside, outside | | .crop({ top, left, width, height }) | Extract a region | | .format(fmt) | Convert to webp, avif, jpeg, or png | | .quality(n) | Set quality 1-100 | | .blur(sigma) | Gaussian blur |

Variants

Pre-define named transform sets in your config:

const darkroom = createDarkroom({
  variants: {
    thumbnail: {
      name: "thumbnail",
      transforms: [
        { type: "resize", width: 200, height: 200, fit: "cover" },
        { type: "format", format: "webp" },
        { type: "quality", quality: 75 },
      ],
    },
    hero: {
      name: "hero",
      transforms: [
        { type: "resize", width: 1920 },
        { type: "format", format: "avif" },
        { type: "quality", quality: 80 },
      ],
    },
  },
});

const pipe = darkroom.variant("thumbnail");
const result = await darkroom.process("./photo.jpg", pipe);

Responsive Images

Generate multiple sizes and formats for <picture> elements:

const responsive = await darkroom.responsive("./hero.jpg", {
  breakpoints: [640, 1024, 1536],
  formats: ["webp", "jpeg"],
  quality: 80,
  urlFor: (width, format) => `/images/hero-${width}.${format}`,
});

// responsive.srcset  — "hero-640.jpeg 640w, hero-1024.jpeg 1024w, ..."
// responsive.sizes   — "(max-width: 640px) 640px, (max-width: 1024px) 1024px, 1536px"
// responsive.sources — [{ format: "webp", srcset: "...", type: "image/webp" }, ...]

Blur Placeholders

Create tiny blurred placeholder images for progressive loading:

const placeholder = await darkroom.placeholder("./photo.jpg");
// "data:image/png;base64,..."

React Components

import { Picture, BlurImage, DarkroomProvider, useDarkroom } from "shutterbox/react";

// Wrap your app with DarkroomProvider for useDarkroom() access
<DarkroomProvider darkroom={darkroom}>
  <App />
</DarkroomProvider>

// Responsive <picture> from a ResponsiveSet
<Picture src={responsiveSet} alt="Hero image" />

// Blur-up placeholder animation
<BlurImage
  src="/images/photo.jpg"
  placeholder={blurDataUrl}
  alt="Photo"
  transitionMs={500}
/>

Next.js Image Handler

Create an API route that processes images on-the-fly:

// app/api/image/route.ts
import { createImageHandler } from "shutterbox/next";
import { createDarkroom } from "shutterbox";

const darkroom = createDarkroom();
export const GET = createImageHandler(darkroom, {
  maxWidth: 3840,
  defaultQuality: 80,
});

Then use query parameters:

/api/image?src=./public/photo.jpg&w=800&f=webp&q=80

Build-Time Optimization

Process all images in a directory during your build:

import { optimizeStaticImages } from "shutterbox/next";

await optimizeStaticImages("./public/images", {
  formats: ["webp", "avif"],
  widths: [640, 1024, 1536],
  quality: 80,
  outDir: "./public/images/optimized",
});

License

MIT