Simple Image Optimization and Reduction

Image optimization and reduction is critical to website performance and speed. File minification and gzip work well for text bases assets like HMTL, CSS, SVG and Javascript; but images don’t take advantage of these types of compression.

To minify images I like to use reducers and compressors that don’t visibly damage image quality.

Mac Image Optimization

On OS X I like to use ImageOptim for a solid image pass through. I also use ImageAlpha for PNG images that require more refinement.

Photo of imageoptim

 

Ubuntu Server Image Optimization

For Ubuntu Servers where I’m dealing with client uploaded images or images that are not contained within an application I use two image optimizers to pass over and help a little. This technique is not meant to be highly effective.

These tools are jpegoptim and optipng. To install them on Ubuntu use apt-get.

apt-get install optipng
apt-get install jpegoptim

Ubuntu apt-get installs an old version of optipng but I have not had any issues with it.

Usage

For JPEG files jpegoptim works well when used with the find command.

find YOUR_DIR_NAME_HERE -iname '*.jpg' -type f -exec jpegoptim {} ;

For PNG files I use optipng.

find YOUR_DIR_NAME_HERE -iname '*.png' -type f -exec optipng -o3 {} ;

Author: Kevin

Howdy, I’m Kevin Dees. I’m the founder of Robojuice. It is a web strategy company focused on delivering a refined experience to partners. I’m also the creator of TypeRocket for WordPress.