SSH JpegOptim

Step 1: Installing jpegoptim in Ubuntu

First things first, before we can attempt to optimize our images, let’s install the tool jpegoptim. Google is recommending this tool and I believe may use this on their own websites.

apt-get install jpegoptim

Step 1: Installing jpegoptim in CentOS 

We are compiling the source tar. Make sure to check for the latest version here:

cd /path/to/scripts

Get the tar archive


Let’s extract this stuff:

tar -xzf jpeg*

Go into the folder:

cd ./jpeg*

Let’s compile this:

make install

You should get a response similar to this:
Compiling Jpegoptim On Centos.png

Let’s quickly test if it works


You should get back “file arguments missing” or similar depending on the version

Step 2: Let’s Get This Done And Optimize Images Losslessly

Now the easy part. All we have to do is to cd into the directory with our images and execute a simple command.

cd /path/to/images/

your path in DirectAdmin will be something like:

This will compress any jpg images stored in /my/path LOSSLESSLY, which means image quality will not suffer. In any case, it is a good idea to make a backup of your original image folder before you execute this (just in case).

cp -R /images/ /imagesLL/

Then run the lossless compression:

find /my/path -name '*.jpg' -type f -print0 | xargs -0 jpegoptim -o --strip-all

Note the apostrophes around the extension, else you may get an error “paths must precede expression”.

Hebt u meer vragen? Een aanvraag indienen


Mogelijk gemaakt door Zendesk