How To Install pngquant on Ubuntu 22.04

In this tutorial we learn how to install pngquant on Ubuntu 22.04. pngquant is PNG (Portable Network Graphics) image optimising utility

Introduction

In this tutorial we learn how to install pngquant on Ubuntu 22.04.

What is pngquant

pngquant is:

pngquant is a command-line conversion utility to quantize and dither truecolor PNG images, especially those with a full alpha channel, down to 8-bit (or smaller) RGBA-palette PNGs. Such images are usually two to four times smaller than the full 32-bit versions, and partial transparency is preserved quite nicely. This makes pngquant especially useful both for Web sites and for PlayStation 2 development, where one of the texture formats is RGBA-palette-based (though not PNG-compressed). This is the same technique used for many of the images on the Miscellaneous Transparent PNGs page (http://www.libpng.org/pub/png/pngs-img.html), and the results are often indistinguishable from the original, truecolor PNG images.

Optimizers (like pngcrush and optipng) optimize the compression, usually losslessly, while pngquant quantizes colors down to 256 (or fewer) distinct RGBA combinations, which is lossy.

There are three methods to install pngquant on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install pngquant Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install pngquant using apt-get by running the following command:

sudo apt-get -y install pngquant

Install pngquant Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install pngquant using apt by running the following command:

sudo apt -y install pngquant

Install pngquant Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install pngquant using aptitude by running the following command:

sudo aptitude -y install pngquant

How To Uninstall pngquant on Ubuntu 22.04

To uninstall only the pngquant package we can use the following command:

sudo apt-get remove pngquant

Uninstall pngquant And Its Dependencies

To uninstall pngquant and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove pngquant

Remove pngquant Configurations and Data

To remove pngquant configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge pngquant

Remove pngquant configuration, data, and all of its dependencies

We can use the following command to remove pngquant configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge pngquant

References

Summary

In this tutorial we learn how to install pngquant package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.