Compress all images on the server without quality loss

This post shows how to save server disk space using images compression. The following commands do not loss the picture quality, but only remove unnecessary data from them.

To compress all JPG images in the directory /var/www run this command:

 

To compress all PNG images in the directory /var/www run this command:

 

In this way you can add these commands to CRON:

Above task will run every Sunday at 03:00 am.

 

The compression consumes a lot of CPU resources, sometimes close to 100%. I recommend you perform compression when there are few visitors.

 

I ask you to review this article

Rating 5 Stars from 4 reviews

Leave a Reply

Your email address will not be published. Required fields are marked *

16 − 14 =