How to compress all your images

What is the Hoasted image optimization tool?

Hoasted imagecrunch uses smart compression techniques to reduce the file size of your PNG and JPEG files on demand. By selectively decreasing the number of colors in the image, fewer bytes are required to store the data. The effect is nearly invisible for your website visitors, but it makes a very large difference in file size. This will not only save space on your account, but also speeds up loading times of your website pages tremendously!


Hoasted image optimization tool Hoasted image optimization tool
Example image original
Size 319kb
Example image optimized
Size 104kb


At Hoasted we have the image crunch built into our hosting platform. In order to make use of this, follow the steps below. Do not that this process is resource intensive, so it is recommended that you perform these steps on a moment you are not editing your website or have other maintenance work going on.


How to use Hoasted imagecruch on your account (Apple/MacOS)

1. Open Terminal and login to your account

Login to your account by typing in the following:

ssh yourusername@srv07.hoasted.com

Your username is your cPanel username. Replace 'yourusername'’srv07' with the correct username and server (for example johndoe1@srv05.hoasted.com).

You are now asked for your password. Use your cPanel password to proceed.

Note: If you get the message ‘If you need shell access please contact support.’, you need to let us know via support@hoasted.com. We will enable shell access for you.


2. Going to the right folder

Now you are logged in and see [yourusername@srv07 ~]$ in the screen. You now want to proceed to the folder where you want your images to be optimized. If you want all your web images to be optimized, you want to go to the public_html folder.

Typ in:

cd public_html/

and hit enter. You now see [yourusername@srv07 public_html]$

Note: If you want to go to a subfolder of your public_html folder, you can typ in cd public_html/subfoldername before proceeding to the next step.


3. Start JPEG image crunch

In order to crunch all your JPEG images, typ in (or paste the line below):

find . -name "*.jpg" -type f -exec jpegoptim {} \;

and hit enter. Now you visually see all your JPEG images being are optimized. This process can take a while depending on the amount of images.


4. Start PNG image crunch

In order to optimize all PNG images, the procedure is similar.

Typ in:

find . -name '*.png' -print0 | xargs -0 -P2 -L1 pngquant --ext .png --force 256

Hit enter. Optimizing PNG images will take a little longer and does not show you a visual update of the crunched images. The imagecrunch is ready the moment you see [yourusername@srv07 public_html]$ in your screen again.


5. Logout

In order to close the connection, you typ in:

exit

You will now be logged out, and the following message will be displayed as a confimation: Connection to srv07.hoasted.com closed.

How can we help you?

We want you to ask us questions, because we love to help you in accomplishing your goals. We let no questions unanswered, provide you with high speed responses and leave no problem unsolved. What is important to you, is important to us. Shoot us a message and see for yourself.