

You can however change the suffix as you wish like below.

Like I already said, the output filename is the same as the input name except that it ends in "-fs8.png", "-or8.png". For instance, to convert all images in a folder named "/home/sk/images", run: $ pngquant /home/sk/images/*.png Change output filename suffix $ pngquant picture1.png picture2.pngĪlso, we can move all files in a directory and compress them in one go. The following command will compress picture1.png and picture2.png in the current working directory. Pngquant can also convert multiple images. Now you will see the progress while compression takes place. No errors detected while quantizing 1 image. Writing 256-color image as ostechnix-fs8.png

Mapped image to new colors.MSE=0.055 (Q=99) If you want to view the status message, use this command: $ pngquant ostechnix.png -verboseĬorrected image from gamma 2.2 to sRGB gammaĮliminated opaque tRNS-chunk entries.61 entries transparent Both images will look almost same! Display status message while compressingīy default, Pngquant will not display what's going on behind the scenes when compressing images.

You won't find much difference in quality between the original and compressed images. Open the image using any image viewer and compare them. See? Pngquant has reduced the 152k size image to just 48k. Let us again check the compressed image file size: $ du -sh ostechnix-fs8.png 48K ostechnix-fs8.png If you're not happy with the compression rate, simply delete the compressed file and keep the original one. Meaning it will not overwrite the source file. By default, Pngquant will use output filename same as input filename with suffix -or8.png or -fs8.png at the end. The above command will compress ostechnix.png file and save it as a new file with name "ostechnix-fs8.png". To compress a PNG image with Pngquant, just provide its path like below: $ pngquant ostechnix.png $ du -sh ostechnix.png 152K ostechnix.pngĪs you can see, the image size is 152k. I have PNG image file named "ostechnix.png" in my current directory. Pngquant usage is trivial and doesn't require any special skill to use it. Compress PNG Images On Linux Using Pngquant $ cd pngquant $ sudo cargo build -releaseįor other installation methods, please refer Pngquant official installation page.
#Lossy png compressor install
Git clone the latest version of Pngquant: $ git clone -recursive įinally, build and install Pngquant using Cargo like below. Install Rust Programming Language In Linux.First, install Rust as described in the following link. Pngquant can also be installed using Cargo package manager. You need to run this command first then run and "sudo make install" command. If you want to install it in another directory run: $. Pngquant will be installed in /usr/local/bin location by default. Switch to the "pngquant directory: $ cd pngquantįinally, run the following commands to compile and install Pngquant: $ make $ sudo make install
#Lossy png compressor download
The above command will download the contents of Pngquant GitHub repository and save it in a folder named "pngquant" in your current working directory. Next, git clone the latest version of Pngquant: $ git clone -recursive On CentOS, Fedora: $ sudo yum install git libpng-devel gcc cmake On Debian, Ubuntu: $ sudo apt install git gcc cmake libpng-dev pkg-config Install Pngquant from sourceįirst, install install the necessary dependencies. If you want the most recent version, compile and manually install it from source like below. The version of Pngquant available in default repositories might be old. On CentOS: $ sudo yum install epel-release $ sudo yum install pngquantĬheck the installed Pngquant version: $ pngquant -V On openSUSE: $ sudo zypper install pngquant To enable Universe repository, do: $ sudo add-apt-repository universe On Ubuntu systems, you need to enable repository to install Pngquant. On Debian, Ubuntu, Linux Mint: $ sudo apt install pngquant Enable Community repository and install it using Pacman like below. On Arch Linux and its variants, Pngquant is available in repository. Pngquant is available in the default repositories of most Linux distributions. Install Pngquant from distribution's repositories
