Images and Photos

Install pngquant – Lossy PNG Compression App on Linux

If you are looking for a simple image compression tool, check out pngquant, a command-line utility and a library for lossy compression of PNG images.

The app conversion reduces file sizes significantly (as much as 70% of original size) whilst preserving the full alpha transparency of the image. All generated images are compatible with all modern web browsers, as well as having a better fallback in IE6 than 24-bit PNGs.

Key Features

  • High-quality palette generation using a combination of vector quantizationalgorithms.
  • Unique adaptive dithering algorithm that adds less noise to images than the standard Floyd-Steinberg.
  • Easy to integrate with shell scripts, GUIs and server-side software.
  • Fast mode for processing large numbers of images.

pngquant

Algorithm

  • It uses modified version of Median Cut quantization algorithm and additional techniques to mitigate deficiencies of Median Cut.
  • Instead of splitting boxes with largest volume or number of colors, boxes are selected to minimize variance from their median value.
  • Histogram is built with addition of a basic perception model, which gives less weight to noisy areas of the image.
  • To improve color further, histogram is adjusted in a process similar to gradient descent (Median Cut is repeated many times with more weight on poorly represented colors).
  • Finally, colors are corrected using Voronoi iteration (K-means), which guarantees locally optimal palette.
  • pngquant works in premultiplied alpha color space to give less weight to transparent colors.
  • When remapping, error diffusion is applied only to areas where several neighboring pixels quantize to the same value, and which are not edges. This avoids adding noise to areas which have high visual quality without dithering.

See Changelog for most recent update

How to install latest pngquant on Ubuntu 16.04

apt-get install git libpng16-dev

git clone --recursive https://github.com/pornel/pngquant.git

cd pngquant

make

sudo make install

Visit https://pngquant.org for basic steps on how to use the tool

About the author

Avatar

Admin

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.

Leave a Comment