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: http://www.kokkonen.net/tjko/src/

cd /path/to/scripts

Get the tar archive

wget http://www.kokkonen.net/tjko/src/jpegoptim-1.4.1.tar.gz

Let’s extract this stuff:

tar -xzf jpeg*

Go into the folder:

cd ./jpeg*

Let’s compile this:

./configure
make 
make install

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

Let’s quickly test if it works

jpegoptim

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:
home/username/domains/domainname/public_html

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

Opmerkingen

Mogelijk gemaakt door Zendesk