Compress PNG files

Make PNGs smaller without blurring sharp UI edges. Start with lossless optimization; switch to modern formats when size matters most.

Last updated: 2026-03-18

To compress PNG files, run npx optimo image.png. Optimo applies ImageMagick-powered compression by default. For stronger reduction, use --lossy or --resize to shrink dimensions — often the single biggest lever for file size.

Start with optimo

First, run optimo on your image file:

npx optimo image.png

This is safe: optimo keeps the original if the output isn't smaller.

Two big levers

1) Lossy mode
npx optimo image.png --lossy
2) Resize (dimensions)
npx optimo image.png --resize w1280

Practical tips

  • If it’s a photo, convert to JPEG/WebP/AVIF — PNG is rarely optimal.
  • For UI assets and logos, keep PNG when transparency + crisp edges matter.
  • Use `--resize` when dimensions are oversized; it often beats “more compression”.

Consider converting

Sometimes the best compression is picking a better delivery format.

Popular conversions

Frequently asked questions

How do I compress PNG files?
Run "npx optimo image.png" to compress PNG with lossless optimization. For stronger compression, add --lossy. For size reduction through resizing, add --resize followed by a percentage, dimensions, or target file size.
What is the best way to reduce PNG file size?
The two biggest levers are resizing (reducing dimensions to match display size) and lossy compression. Resizing usually has a larger impact than codec-level compression. Sometimes converting to a more efficient format is the best approach.