So here’s a quick guide on a completely automated way to optimize all your jpegs in CentOS to increase your pagespeed rank and hopefully boost your SEO too. This will also help get rid of any PageSpeed errors like “Optimize Images” by reducing file sizes by up to 40%!
An example of how Google wants you to optimize your jpegs in order to boost your pagespeed rank
1. Install jpegotim
yum install jpegoptim
2. open a SSH session or terminal and navigate to your folder where your website files are located. Generally under centOS this is /home/YOURWEBSITE
cd /home/YOURWEBSITE
3. Run jpegoptim against all jpegs
Just copy this code and run
find . -type f -name “*.jpg” -exec jpegoptim {} \;
Note: this will strip all image meta tags so make sure you don’t have any personal images in there
And done, wait for any caches to clear or clear them yourself and rerun Google PageSpeed Insights.