Tools for image optimization and compression

Image optimization is a great way to decrease overall website file size, thus making it load faster and saving bandwidth.
This is a list of tools and Linux commands I use for image optimization and batch resizing.

Linux command line tools

Image bach resizing (resizes images larger than specified size, where width = XXXX and height = YYYY, in pixels), this requires installation of imagemagick:

find . -type f | xargs mogrify -resize 'XXXXxYYYY>'

PNG optimization (install optipng):

find . -name *.png | xargs optipng

exif data removal (install exiv2):

exiv2 -d a *.jpg

Losless JPEG optimization (install jpegoptim):

jpegoptim *.jpg --strip-all

Script for recursive image optimization with jpegoptim in subdirectories:

optimize() {
   jpegoptim *.jpg --strip-all
   for i in *
      if test -d $i
         cd $i
         echo $i
         cd ..

Online tools

GUI tools

  • – great Linux GUI tool for png and jpeg optimization,
    I love it’s simplicity – just drag and drop the images and that’s it
  • – very similar to Trimage, but for Mac platform
  • – many advanced options for image batch processing – resizing, converting for Linux, Mac and Windows. I really liked this tool and found it very powerful when I was less familiar with command line and Imagemagick in particular.

Leave a Reply

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