Shipping web assets
Shrink hero images and convert to WebP/AVIF before deploying a site.
imgsqz is a fast command-line tool for compressing images and
converting between formats. It wraps the excellent
sharp library (built on libvips) behind a
single, memorable command with sensible defaults.
imgsqz photo.png # → optimized JPG next to the sourceimgsqz hero.jpg -f webp # → WebP at quality 80imgsqz *.png -f avif -q 50 # → batch-convert a folder to AVIF--replace.It is also not a watcher, a build plugin, or a service. It does one job — take image files in, write optimized image files out — and exits.
Shipping web assets
Shrink hero images and convert to WebP/AVIF before deploying a site.
Cleaning up screenshots
Turn multi-megabyte PNG screenshots into compact JPGs for docs and issues.
Prepping uploads
Resize and compress a folder of photos before sending or archiving them.
CI pipelines
Add a deterministic, scriptable optimization step that fails loudly.
| Command | imgsqz |
| Install | npm install -g @wdalhaj/imgsqz |
| Run without installing | npx @wdalhaj/imgsqz <input> |
| Input formats | Anything sharp can read (JPG, PNG, WebP, AVIF, TIFF, GIF, SVG, …) |
| Output formats | jpg · png · webp · avif · tiff |
| Runtime | Node.js 18+ |
| Engine | sharp ^0.33 (libvips) |
| License | MIT |
Ready? Head to Installation.