Image optimization using Yahoo!

Apr 25, 2012

I´ve recently looked more into various quick-wins and minor optimization techniques — and in that search I came across Yahoo!´s service for (automatically) optimizing image. is a webservice provided by the Yahoo! Developer Network. Yahoo! describes the service like this: uses optimization techniques specific to image format to remove unnecessary bytes from image files. It is a "lossless" tool, which means it optimizes the images without changing their look or visual quality. After runs on a web page it reports how many bytes would be saved by optimizing the page's images and provides a downloadable zip file with the minimized image files.

So, we can use the service as a paste/upload-click-and-download service to process a single image, but what is even more interesting is that it´s actually available via scripting ... and just as great — it will give you a JSON-result when done :)

Using programmatically

The service can be called using the following URL:

Go ahead, try it:

I can´t really remember where I found this tip, but it immediatly gave me an idea — I´ve now setup a few cronjobs for automatically optimizing images on my blog.

  1. First job crawls a few predefined folders and adds images to a database table (if they are not already present).
  2. Second job simply crunch through the table and processes the found images using the URL above. This gives me a JSON-result from which I get an URL to an optimized version of my image, that I simple download and replace the old version with.

Tadahh ... This might not sound like much, but some of my images are being reduced up to 50% of their original size, so I´m a happy camper for now :)


comments powered by Disqus