Skip to content
imgsqz logo imgsqz logo

imgsqz

Compress & convert images straight from your terminal. One command, five formats, sane defaults.
Terminal window
npm install -g @wdalhaj/imgsqz

Then squeeze an image. The default writes an optimized JPG next to the source:

Terminal window
imgsqz photo.png
# photo.png
# → photo_20260611_132517.jpg
# 2.41 MB → 412.08 KB (↓ 83.3%)

One mental model

A single command with flags you can actually remember. No config files, no plugin graph, no build pipeline to wire up.

Five formats

Convert freely between JPG, PNG, WebP, AVIF and TIFF — each tuned with smart encoder defaults (mozjpeg, palette PNG, lossless modes).

Safe by default

Never clobbers your source unless you ask. --replace writes to a temp file and atomically renames, so an interrupted run can’t corrupt originals.

Batch friendly

Pass globs like *.png to process whole folders, with a per-file size report and a non-zero exit code if anything fails.

Correct orientation

EXIF orientation is honored automatically, so phone photos come out upright every time.

Powered by sharp

Built on sharp + libvips for fast, high-quality, native-speed encoding.