A notch above a monkey » Shrinking images with image-diet

Shrinking images with image-diet

I like easy-thumbnails and use it often in my Django projects, but I wished for a long time that its PIL generated thumbnails would be smaller. That’s why I wrote image-diet, a drop-in extension for those easy-thumbnails users who use file system for storing images. Images remain visually the same, but can be significantly smaller (mine by more than 50% but your mileage my vary).

This matters because images are together with Javascript main cause for ever larger page sizes which leads to slower websites, especially in low-bandwidth environments. But really, don’t we all want our websites to be as fast as possible?

image-diet was inspired by ImageOptim and Trimage and I’m grateful to authors of both. It uses jpegtran, Jpegoptim, Gifsicle, OptiPNG, AdvanceCOM PNG and Pngcrush to do the heavy work of squeezing redundant bytes. Getting them should be easy as they are part of Ubuntu distribution and can be installed on Mac with brew. For more information please check documentation or ask.

I would love to hear any comments and ideas you may have, even more so if you try it.

Comments (2)

  1. Hi Marko,
    just bumped into the issue of squeezing image size by 50% according to google’s speedpage and found your news about the image-diet!
    Thank you for your work, hope it’s what I need. How about the app to be used in production?


    Comment by Tigors #
  2. It is used, but not widely yet and certainly not on any high-traffic website.

    I haven’t checked easy_thumbnails code closely enough to know if there are problems in multithreading environments, but I can’t think of a problem that would actually be caused by image-diet.

    Comment by markos #

Sorry, the comment form is closed at this time.