jpegtran for image optimization

jpegtran is a libjpeg command-line utility. It allows you to manipulate JPEG files, but its most useful function is optimization.

Installation of jpegtran

For Linux, this utility is usually found in packages:

# apt-get install libjpeg-progs

Usage

For the basic version of optimization, we call the command:

# jpegtran -copy none -optimize -outfile min.image.jpg image.jpg

The abobe command saves the optimized copy to min.image.jpg

-copy none removes all metadata from the source file.
-optimize optimizes image.

Progressive

To change the format to progressive, use the following command:

# jpegtran -progressive -copy none -optimize -outfile min.pro.image.jpg image.jpg

The above command saves the result to the min.pro.image.jpg file.

Quality change

You can also specify the compression ratio to visually select the best value:

# jpegtran -quality 80 -copy none -optimize -outfile min.pro.image.jpg image.jpg

Try different values from 5 to 95.

Related Post