Scott Hanselman has referred to lossless image compression/optimization, especially PNG files, for quite some time. I’ve also been using these tools for ages but was surprised to hear how few people were actually aware of them. I also wanted to go a step further and see if there were ways to compress and optimize JPEGs and GIFs in the same lossless fashion, this is what I found…

Image Compression Tools

PNGGauntlet is a fantastic option which uses three different tools to perform the optimizations and in parallel. However, it doesn’t provide any optimizations for JPEG or (everyone's favorite format) GIF files although it can convert them to PNG. I like to be up to date as well and the tools that it uses are not always the latest that are out there. Then along comes ImageOptim and Trimage which run your images through a couple more tools but, the software is only available for Mac and Linux. Based on these, this is the list of tools I settled on:

I won’t touch on any more information about these tools, visit the sites if you are interested in further information.

Automation Batch File

The secret is in the combination of all these tools to get the maximum compression possible, as well as using the correct options for best results. I didn't want to create a UI for it but also wanted to make it easy enough for anyone to use, so I wrote a batch file to run your images through the tools in the correct order with the right options. All the requires is that you specify a directory path to recursively compress, this could easily be used as a shell extension as well.

The download contains two batch files.

  1. _Download.bat will just pull and extract the required tools off the internet (PowerShell required) so that you can always have the latest versions.
  2. _Optimize.bat will do all the heavy lifting of trawling through a directory for images to compress.


Even the above screenshot was compressed from 20KB to 12KB, now imagine what this can do to your whole website or even games?

NB:Running this tool will overwrite the images in their respective directories, just be aware of that.

NB2: I have seen some rare scenarios recently where images that have gone through DeflOpt do not render on certain mobile browsers. Be careful of this and remove the call if you experience this problem.


Using these tools is a fast and cheap way of reducing the bandwidth requirements for your websites and games. More people need to know that there are tools available like this and start making use of them. Stop wasting bandwidth and compress your images today, you have nothing to lose, not even image quality!

Download Image Optimizer – includes 7-zip command-line to extract the downloaded tools, don't use spaces in your path, some of the tools don't like it so the batch file doesn't try handle it.