Easy Image Optimization & Compression with JpegOptim in Linux (Ubuntu)

Image optimization or compression is a feature that is required frequently. A simple application available in Ubuntu is JpegOptim, but first it needs to be installed.

Installing JpegOptim

Run the following command:

sudo apt-get install jpegoptim

Compressing an Image to 75%

Run the command:

jpegoptim --max=75 flower.jpg

Here flower.jpg can be any file along with its absolute or relative path.

Compressing all images in a directory to 75%

This command will compress all the JPEG images in the current directory:

jpegoptim --max=75 *.jpg

Compressing all images and save them to a different directory

This command will compress all the JPEG images in the current directory and instead of overwriting them, save them in a different destination directory:

jpegoptim --max=75 *.jpg --dest=/home/images/

Display the Progress

Run the command with the additional -v switch:

jpegoptim --max=75 -v *.jpg

Display the Help

jpegoptim --help

Enjoy it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s