Performance Feature – Automatic Lossless Image Compression

We have created a new robot – his name is optimizerbot and he will look through your themes daily to find any PNG or JPEG images that can be losslessly compressed and automatically commit the compressed version to your theme’s subversion repository.   We have found that about 80% of existing images in VIP themes can be compressed this way, saving precious bytes and providing a better user experience, especially on slower networks, like 3G.

Here is an example of what the commit message will look like

The first column is the file name, second column is the old file size in bytes, third column is the new file size in bytes, and the last column is the % saved.

Technical details for those who are interested:

  • PNGs are being compressed using OptiPNG.
  • JPEGs are being compressed using jpegoptim.
  • The script we are using to do the compression will soon be available in the WordPress Code SVN repository.
  • We invalidate our CDN whenever static content is changed which means users will begin downloading optimized versions of these files shortly after the changes are deployed.
  • For those familiar with Trac Wiki syntax you probably will recognize the || separator. This creates a table layout in Trac, which we use internally for reviewing changes in some cases.

Enjoy and please leave your feedback/questions in the comments!

14 thoughts on “Performance Feature – Automatic Lossless Image Compression

  1. Cool feature. Do you currently (or plan to) do this with uploaded media? I saw the ‘optimizing images’ support article which suggests you are not/will not and recommend bloggers perform optimizations outside of WordPress, is that right?

    • We currently do optimize uploaded media if it is re-sized (w or h query args appended). If the media is embedded and served at the original uploaded size (no query args appended to the URL) currently we do not optimize it, although we might start – I need to look into the CPU/memory requirements a bit more before making a decision.

  2. How soon it’ll be available in repo? Currently working on a heavy graphic site (lots of hi-res photos) and would love to use this feature.

Comments are closed.