Batch Compress PNGs with pngquant
Quantize PNG files to 256-color palettes for massive file-size reductions that are nearly invisible on screenshots and web graphics.
Run pngquant --quality=65-80 --skip-if-larger --ext .png --force *.png to compress every PNG in place, skipping any file that would end up bigger.
01Command
Command
$ pngquant --quality=65-80 --skip-if-larger --ext .png --force *.png02What it does
pngquant converts 32-bit RGBA PNGs to 8-bit palette images using dithering, typically cutting 60-80% of the size — far more than optipng's lossless shuffle. --quality=65-80 makes it refuse to write a file whose quantized quality falls below 65, and --skip-if-larger guarantees no file grows. The --ext .png --force pair overwrites files in place; combine with find -name '*.png' -exec for whole directory trees.
03Risk
!Warning: This is lossy quantization: gradients and photos can band. Keep originals, and skip pngquant for images that must stay lossless.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- pngquant READMEEvidence: States pngquant 'converts RGBA PNGs to 8-bit palette PNGs' with typical savings of 60-80% and lossy-but-near-transparent quality.
- pngquant(1) — Linux man pageEvidence: pngquant man page documenting --quality min-max, --ext, --force, --skip-if-larger and in-place batch conversion of PNGs.
Last verified: 2026-09-17 · Category: Media