How to install and use jpegoptim on Linux CentOS

October 26, 2018

If you have a bunch of jpgs that you want to optimise, you will probably want to use jpegoptim. Here is how to install it on Linux CentOS

yum install jpegoptim

How to use jpegoptim on Linux CentOS

The syntax for using jpegoptim is simple - jpegoptim yourImage.jpg. Of course, there are some options you can pass to it.

How to use jpegoptim on Linux CentOS to optimise all images (recursively) in a directory

Use the following command to automatically recursively go through the current directory (and all subdirectories/folders) and optimise the jpg image, lowering its file size. You won't notice any difference in quality, but it will strip all useless information stored in the jpg's meta data

find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;

You should also see my page explaining how to do the same thing but for png images