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

picoptim

v1.0.0

Published

Resize AND optimise images on macOS. ImageOptim-CLI compresses but cannot resize — this does both in one command.

Readme

picoptim

Resize and optimise images, in one command. macOS only.

ImageOptim-CLI is excellent at squeezing bytes out of an image — but it cannot change an image's dimensions. That matters, because for most web work the resizing is where the savings actually come from:

4 photos straight off a phone/camera
  6.74 MB  →  0.87 MB   (-87%)

  resize 2268×4032 → 900×1600 ......... -83%
  ImageOptim on top of that ...........  -4%

imgopt does the resample first (with sips, built into macOS, or ImageMagick if you have it) and then hands the results to ImageOptim.

Install

npm install -g picoptim

You also need ImageOptim.app itself — ImageOptim-CLI automates the GUI app, it does not reimplement it:

brew install --cask imageoptim

Optional extras, picked up automatically when present:

| Tool | Why | | --- | --- | | ImageMagick (brew install imagemagick) | Better Lanczos resampling than sips | | ImageAlpha | Lossy PNG via -a | | JPEGmini | Extra JPEG compression via -j |

Usage

imgopt -m 1600                 # longest side ≤ 1600px → ./optimized/
imgopt -w 1200 -o web *.jpg    # max width 1200px → ./web/
imgopt -m 800 -i photos/       # overwrite the originals in photos/
imgopt -p 50                   # scale to 50%
imgopt                         # optimise only, no resizing
imgopt -m 1600 -n              # dry run: show the plan, write nothing

Options

Resize — never upscales an image that is already smaller than the target.

| Flag | Description | | --- | --- | | -m, --max N | Longest side at most N px | | -w, --width N | Max width N px | | -H, --height N | Max height N px | | -p, --percent N | Scale to N% of the original |

Output

| Flag | Description | | --- | --- | | -o, --out DIR | Destination directory (default: ./optimized) | | -i, --in-place | Overwrite the originals — no copy is kept |

Optimisation

| Flag | Description | | --- | --- | | -a, --imagealpha | Enable ImageAlpha (lossy PNG, much smaller) | | -j, --jpegmini | Enable JPEGmini | | -q, --quality MIN-MAX | ImageAlpha quality 0–100 (default 65-80) | | -R, --no-optimize | Resize only, skip ImageOptim |

Other

| Flag | Description | | --- | --- | | -r, --recursive | Include images in subdirectories | | --engine E | sips, magick or auto (default auto) | | -n, --dry-run | Show what would happen, write nothing | | -h, --help / -V, --version | |

Supported formats: JPEG, PNG, GIF, TIFF.

Design notes

Originals are never touched by default. Output goes to ./optimized/. ImageOptim overwrites in place with no undo — combine that with a downscale and the original is gone for good. -i opts into that behaviour explicitly.

No upscaling. An 800px image asked to fit in a 1600px box is left at 800px, rather than being interpolated up to a blurrier, larger file.

Aspect ratio is preserved. -m/-w/-H define a box to fit inside; the scale factor is computed from whichever constraint binds first.

Why not just ImageMagick?

You can absolutely do magick mogrify -resize 1600x1600\> *.jpg. What you don't get is the ImageOptim pass — the lossless zopfli/pngout/jpegoptim work that shaves the last few percent — nor the safe-by-default output directory, the no-upscale rule, or the before/after accounting. imgopt is the two halves wired together with sensible defaults.

Requirements

  • macOS (uses sips and drives ImageOptim.app)
  • Node.js ≥ 14 (to install via npm)
  • ImageOptim.app

License

MIT © Bruno Pinheiro