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!
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.
Aha, makes sense. Thanks, Barry!
Awesome. How soon will we be able to see/test them on production?
We ran through the first batch last night. We will finish the rest over the next couple of days.
can’t wait! 🙂
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.
Hopefully next week. It’s active on WordPress.com now (I guess you have noticed).
Sure did! Thanks.
bump, eeh?
Sorry for the delay. It has been committed now. https://code.svn.wordpress.org/optimize-images/ GPL, of course.
Thanks a lot!
Finally had time to poke at the script, got it working, although spent some time to discover that filter should be always included. Otherwise
find $DIRNAME -type f |egrep -v “$FILTER” |egrep -i ‘[.](jpg|jpeg|png)$’ >$FILELIST
returns nothing. Ended up checking if second parameter is set. Here’s the gist, if you’re interested:
Thanks guys! I am just curious, what are the parameters being used on this command lines tools?