PNGQuant CLI Command Reference

 02 Apr 2021  Meta Code

PNGQuant CLI Command Reference

Install pngquant:

sudo apt install pngquant -y

Shell alias for png filename.png command usage with sensible defaults:

png() { pngquant "[email protected]" --quality 90-100 --speed 1 --skip-if-larger --strip --ext -quant.png }

Above command does the following:

  • Uses a quality scale with minimum of 90% and maximum of 100% for best results
  • Prioritizes quality over speed, which makes no difference on modern hardware
  • Skips the operation if the output file will be larger than the input file
  • Strips all metadata from the file
  • Adds a -quant.png suffix to the file

Example command and output with a filesize reduction of ~64%:

png Screenshot-from-2021-04-02-09-55-45.png

# (exit code 0)

-rw-rw-r-- 1 paramdeo paramdeo  91K Apr  2 09:55 'Screenshot from 2021-04-02 09-55-45.png'
-rw-rw-r-- 1 paramdeo paramdeo  33K Apr  2 10:07 'Screenshot from 2021-04-02 09-55-45-quant.png'
Webmentions & Comments

Copyright © Paramdeo Singh. Built with Jekyll and ❤ in Guyana. All Rights Reserved.

Last Site Build on Tue, 13 Apr 2021 16:55:04 -0400

1MB Club Badge