Image Compression in Ubuntu Linux with Jpegtran

Because the faster the web pages better the impression about your page for the viewers, no one want to wait long till pages gets load and also it’s very annoying. Reducing size and shrinking the images result in reduction of the time taken by the web pages to get open.There are many image compression tools for both windows and Linux operating systems, one of the best tool for compression of images is JPEGTRAN which is used my many web designers.

JPEGTRAN is a Famous Image Compression tool recommend by Google in their official Website for compressing the images on a website without having any dependency on online compressor.  

Jpegtran also works faster and have been quiet famous for its quality.Here we are going to see the method of installation and also the Command for compressing image with Jpegtran. In Ubuntu installation command and compression command might be little different, hope this description will help.


For Ubuntu version installation is simple as for others too .
First you need to login as root.

Installation in Ubuntu

# su root
# apt-get install libjpeg-progs

It’s not necessary to be a root all the time to use this tool.


Command to compress image in Ubuntu Linux

# jpegtran -copy none -optimize -perfect inputimage.jpg > outputimage.jpg

Incase if its not Ubuntu then regular command is

# jpegtran -copy none -optimize -perfect inputimage.jpg outputimage.jpg

without “> “ operator
For an Ubuntu machine the > operator is must or you might sit checking the command to see where things went wrong.

The image compression with a “-perfect” switch and without it almost results in same quality. You can try with checking different switches.

# jpegtran -copy none -optimize inputimage.jpg > outputimage.jpg

All in together Jpegtran is awesome tool for conversion of baseline JPEG to progressive JPEG images.

You can check with other settings and switches with a man command.

# man jpegtran