In this tutorial we will learn,how to install and optimize the png file by using optipng. Optimizing the png format file is very important, in terms of decreasing the website loading page time. If your website has a lots of png file,it may take time to load which also results in decreasing the webpage opening speed.
OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections. (Reference from Optipng project link)

How to install optipng in CentOS/Red Hat/fedora

To install optipng in Red Hat based operating system,first we will install the EPEL repo.To learn about what is EPEL repo and how to install.Read our this post

Installation command syntax is: yum install optipng

In CentOS 5.x /Red Hat 5.x / Fedora

yum install wget
dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
yum install optipng

In CentOS 6.x and Red Hat 6.x

yum install wget
wget dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
yum install optipng

In Fedora

yum install optipng

How to install optipng in Ubuntu/Debian/Linux Mint

To install optipng in Debian based operating system,use the given below command

sudo apt-get update
sudo apt-get install optipng

Installing with optipng tarball

For installing from tarball,login with root or superuser

wget http://kaz.dl.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.4/optipng-0.7.4.tar.gz

tar -xvzf optipng-0.7.4.tar.gz

cd optipng-0.7.4

./configure && make && make install

For installing optipng in Windows

Download the Windows setup zipped file from the prject link http://optipng.sourceforge.net/

Unzip the downloaded file and then run optipng.exe file.

How to optimize PNG file with optipng

Optimizing the PNG file by using optipng is very easy.You have to use the command optipng along with some options and path of PNG file.
Before optimizing file ,check its size.And after running the command,again check the size.You will get PNG file with reduced size

Examples: Use any one example.

optipng pic.png				(default speed)
optipng -o5 pic.png			(moderately slow)
optipng -o7 pic.png			(very slow)
optipng -i1 -o7 -v -full -sim pic.png

For more help and flags, run the command optipng --help

Read Some More Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.