Bulk Image Optimization using Jpegoptim & OptiPNG

Jpegoptim and OptiPNG are Linux Software that strips meta data from images, namely JPEG and PNG images. The result is significant savings on memory and more importantly, faster loading time for websites!

To use Jpegoptim and OptiPNG, the commands are simple. However we are looking at a loop to process bulk files. Here are the commands:

To process JPEG files in the current folder and all files in all children subfolders:

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

To process PNG files in the current folder and all files in all children subfolders:

find -type f -name "*.png" -exec optipng {} \;

To process GIF files in the current folder and all files in all children subfolders:

find -type f -name "*.gif" -exec optipng {} \;

This will save you significant time on image optimization and speeds up your website, a big up point for SEO as pageSpeed is now a factor in usability. Also less visitor will leave because of the slow speed. Learn here what is main reasons causing your website to be slow!

If you think your website is slow and want professional opinion on speeding up your website, contact us today, we have a team of obsessive website optimizers, check out our work on speeding up some resource heavy website to support high traffic uses.