Bulk image compression · Node 22.5+

Images,
pressed.

Point pixelpress at a folder or a glob. Get AVIF, WebP, JPEG, and PNG at the widths you actually ship — with a cache that cleans up, animated WebP, manifests, <picture> snippets, and an API that behaves like the CLI.

Read the docs

Convert any image. Install nothing. npx fetches pixelpress, runs it, and gets out of the way. Add it to package.json only when you want it in the build.

v0.8.0 28 tests 1 runtime dependency MIT
$ npx pixelpress "public/**/*.{jpg,png}" -o dist -w 480,960

pixelpress 42 files → /app/dist (avif,webp)
✓ hero.jpg       1.4 MB → 182.3 KB  87% smaller
✓ team/ana.png   420.1 KB → 61.8 KB  85% smaller
✓ chair.webp     118.4 KB → 44.2 KB  63% smaller

42 files · 84 outputs · 18.2 MB → 3.1 MB
(83% smaller) · 4.2s
Why pixelpress

A press,
not a pipeline.

Most image tools make you choose between one file at a time and a wall of configuration. pixelpress is built for the whole folder: sensible defaults, explicit options, and output that is ready to ship.

01 / BULK

Point at the folder.

Quoted globs, recursive trees, include/exclude filters, symlinks, and collision detection. One command handles the whole asset directory.

"assets/**/*.{jpg,png}" -o dist -r
02 / RESPONSIVE

Every size you ship.

Responsive width sets, never upscaled. Hash filenames, prefixes, suffixes, and a manifest with ready-to-use srcset strings.

-w 480,960,1920 --hash --manifest images.json
03 / FRAMES

Animation survives.

Animated GIF and WebP inputs keep their frames in WebP output, including resized widths. Static formats fall back to the first frame.

-f webp --preset web
04 / BUDGETS

“Smaller than 120 KB.”

Set a per-variant byte budget and pixelpress searches quality down until it fits. If it cannot, the file fails loudly instead of shipping oversized.

--max-bytes 120kb -q 90
05 / REPEAT RUNS

A cache with a broom.

Cached by input mtime + option fingerprint. --prune deletes outputs no longer produced and removes empty directories, without touching inputs.

--cache --prune --watch
06 / SAFETY

No half-files.

Every image, manifest, report, and cache file is written to a temp file and renamed. A failed multi-format run rolls back newly created outputs.

atomic writes · rollback · guarded clean
4output formats
4built-in presets
28test cases
1runtime dependency
The whole job

From source
to shipping.

Gather, transform, encode, and hand off. Nothing hides behind a build plugin you have to install first.

01Gather

Files, folders, globs, filters, symlinks. Mirror the tree or flatten it.

02Transform

Resize, crop, rotate, trim, extend, blur, sharpen, tint, grayscale.

03Encode

AVIF, WebP, JPEG, PNG. Per-format quality, effort, lossless, budgets.

04Ship

Manifest + srcset, <picture>, LQIP, HTML report, or stdout.

Repeated runs

Run it once.
Run it forever.

The cache lives outside your deployable output. The fingerprint covers quality, widths, transforms, and output paths, so changing an option invalidates exactly what it should.

--prune cleans up deleted sources and retired formats. Failed files keep their old outputs. --watch re-runs with the same cache and prune settings.

Cache, prune, watch
terminal
# First run
pixelpress photos -o dist -r

# Second run: unchanged files are reused
pixelpress photos -o dist -r

# Clean retired sizes and formats
pixelpress photos -o dist -r --prune

# Keep going while you work
pixelpress photos -o dist -r --watch
node · optimize.js
import { optimize } from 'pixelpress';

const report = await optimize(
  ['public/images/**/*.{jpg,png}'],
  {
    outDir: 'dist/images',
    preset: 'web',
    widths: [480, 960, 1920],
    cache: true,
    prune: true,
  },
);

console.log(report.totals.savedPercent);
CLI + API

The shell and
the server.

The CLI is a thin surface over the same engine. If it works in your terminal, it works from Node — including transforms, budgets, cache, and failure reporting.

One image through a pipe? --stdout. A whole asset tree? A glob. Need the result in your build? The manifest has paths, bytes, dimensions, quality, and srcset.

Read the API
Output is the product

Ready to
drop in.

No glue code between the encoder and the page. Generate the artifacts your templates already want.

Manifest

Every variant, indexed.

Dimensions, bytes, quality, frames, cache state, and per-format srcset strings in one JSON file.

Picture

Markup that loads.

Animated WebP first, AVIF/WebP sources, static fallback, width and height attributes, lazy loading.

Report

See the whole run.

A self-contained before/after gallery with byte deltas, dimensions, quality, and cache state.

Start with one folder.

Install pixelpress, point it at your images, and get a shipping-ready output tree in one command.