Monthly Archives: August 2013

GNU/Linux cli image optimizer

There are some benefit from lossless recompression utilizing optipng for PNGs, gifsicle for GIFs and jpegoptim for JPGs. Optimized graphics transfer faster and provide a faster perceived response for clients. The following example will recursively optimize (without any loss of quality) all the graphics and image files on a server with the above commands installed and available.


sudo apt-get install optipng gifsicle jpegoptim imagemagick

Then execute this lines where you want to optimize your files. Remember to use the same owner user of those images.

find . -iname *.png -exec optipng -o7 --strip all {} \;
find . -iname *.gif -exec gifsicle -O2 -b {} \;
find . -iname *.jpg -exec jpegoptim --strip-all --max=85 {} \;
find . -iname *.jpg -exec convert -interlace line -quality 80 {} {} \;

For WordPress, you can install EWWW Image Optimizer or WP

Source: Moodle