Running Google Page Speed or YSlow on Drupal sites recommends using a compressed version of files in /misc. It's only small bytes of difference, but the compressed product is visually identical. Using these smaller versions will save a lot of messages for people when they're trying to optimize their sites and won't want to be bothered with messages about 20-30 bytes here and there on images they didn't create.

In #511114: Use smaller feed.png image, we decided Yahoo's Smush.it service has the best compression algorithm, so these attached images were processed through that service alone.

Byte savings summary:

  • menu-collapsed-rtl.png 22 bytes 16.92%
  • menu-leaf.png 57 bytes 29.38%
  • arrow-desc.png 1 byte 0.84%
  • draggable.png 87 bytes 24.93%
  • druplicon.png 58 bytes 1.42%
  • forum-closed.png 5 bytes 0.45%
  • forum-hot-new.png 4 bytes 0.30%
  • forum-new.png 6 bytes 0.53%
  • grippie.png 54 bytes 33.33%
  • tree-bottom.png 40 bytes 4.10%
  • tree.png 40 bytes 4.09%
  • watchdog-error.png 19 bytes 2.38%
  • watchdog-ok.png 2.74 KB 87.22%
  • watchdog-warning.png 19 bytes 5.60%
  • powered-black-135x42.png 19 bytes 0.67%
  • powered-black-80x15.png 12 bytes 0.82%
  • powered-black-88x31.png 19 bytes 0.90%
  • powered-blue-135x42.png 18 bytes 0.59%
  • powered-blue-80x15.png 17 bytes 1.68%
  • powered-blue-88x31.png 16 bytes 0.76%
  • powered-gray-135x42.png 19 bytes 0.70%
  • powered-gray-80x15.png 17 bytes 2.24%
  • powered-gray-88x31.png 19 bytes 0.92%
  • marker.png 149 bytes 22.85%
  • mask.png 19 bytes 0.94%
  • wheel.png 19 bytes 0.16%

I intentionally left the ui directory alone because I assume editing those images would make it slightly harder to sync with updates from jquery ui official releases.

CommentFileSizeAuthor
#36 Smushed Images.zip24.36 KBphilbar
#17 feed.png after ImageOptim through YSlow Smush.it82.87 KBdeekayen
#17 Google Page Speed showing now optimized image options (pair with #13)70.37 KBdeekayen
#17 feed.png before ImageOptim through YSlow Smush.it80.86 KBdeekayen
#17 location of Smush.it in YSlow firebug addon121.58 KBdeekayen
#13 Google Page Speed image recommendation screenshot70.53 KBdeekayen
#10 screenshot of smushed vs original on white background185.82 KBdeekayen
#10 screenshot of smushed vs original on black background148.35 KBdeekayen
#10 index.html used for the screenshot. drop in your cvs checkout or the untarred tgz from #21.05 KBdeekayen
#2 screenshot first run186.33 KBdeekayen
#2 screenshot second run141.97 KBdeekayen
#2 screenshot third run141.43 KBdeekayen
#2 arrow-desc.png118 bytesdeekayen
#2 draggable.png235 bytesdeekayen
#2 druplicon.png3.92 KBdeekayen
#2 feed.png656 bytesdeekayen
#2 forum-closed.png1.05 KBdeekayen
#2 forum-default.png962 bytesdeekayen
#2 forum-hot-new.png1.27 KBdeekayen
#2 forum-hot.png1.14 KBdeekayen
#2 forum-new.png1.09 KBdeekayen
#2 forum-sticky.png1.07 KBdeekayen
#2 grippie.png106 bytesdeekayen
#2 help.png350 bytesdeekayen
#2 farbtastic/marker.png437 bytesdeekayen
#2 farbtastic/mask.png1.95 KBdeekayen
#2 menu-collapsed-rtl.png107 bytesdeekayen
#2 menu-collapsed.png105 bytesdeekayen
#2 menu-leaf.png126 bytesdeekayen
#2 powered-black-80x15.png1.41 KBdeekayen
#2 powered-black-88x31.png1.96 KBdeekayen
#2 powered-black-135x42.png2.64 KBdeekayen
#2 powered-blue-80x15.png943 bytesdeekayen
#2 powered-blue-88x31.png1.96 KBdeekayen
#2 powered-blue-135x42.png2.81 KBdeekayen
#2 powered-gray-80x15.png698 bytesdeekayen
#2 powered-gray-88x31.png1.92 KBdeekayen
#2 powered-gray-135x42.png2.53 KBdeekayen
#2 tree-bottom.png129 bytesdeekayen
#2 tree.png130 bytesdeekayen
#2 watchdog-error.png780 bytesdeekayen
#2 watchdog-ok.png411 bytesdeekayen
#2 watchdog-warning.png320 bytesdeekayen
#2 farbtastic/wheel.png11.32 KBdeekayen
#2 misc.tgz of all the images43.89 KBdeekayen
farbtastic/wheel.png11.44 KBdeekayen
farbtastic/mask.png1.95 KBdeekayen
farbtastic/marker.png503 bytesdeekayen
powered-gray-88x31.png2 KBdeekayen
powered-gray-80x15.png741 bytesdeekayen
powered-gray-135x42.png2.64 KBdeekayen
powered-blue-88x31.png2.05 KBdeekayen
powered-blue-80x15.png994 bytesdeekayen
powered-blue-135x42.png2.94 KBdeekayen
powered-black-88x31.png2.06 KBdeekayen
powered-black-80x15.png1.42 KBdeekayen
powered-black-135x42.png2.73 KBdeekayen
watchdog-warning.png320 bytesdeekayen
watchdog-ok.png411 bytesdeekayen
watchdog-error.png780 bytesdeekayen
tree.png939 bytesdeekayen
tree-bottom.png936 bytesdeekayen
grippie.png108 bytesdeekayen
forum-new.png1.11 KBdeekayen
forum-hot-new.png1.29 KBdeekayen
forum-closed.png1.07 KBdeekayen
druplicon.png3.92 KBdeekayen
draggable.png262 bytesdeekayen
arrow-desc.png118 bytesdeekayen
menu-leaf.png137 bytesdeekayen
menu-collapsed-rtl.png108 bytesdeekayen

Comments

deekayen’s picture

Status: Needs review » Needs work

Of course as soon as I submitted that I discovered ImageOptim which uses a combination of OptiPNG, PNGCrush, AdvPNG, and PNGOUT to maximize the shrink. I'm running it all over again because it found even more savings over Smush.it.

deekayen’s picture

StatusFileSize
new43.89 KB
new11.32 KB
new320 bytes
new411 bytes
new780 bytes
new130 bytes
new129 bytes
new2.53 KB
new1.92 KB
new698 bytes
new2.81 KB
new1.96 KB
new943 bytes
new2.64 KB
new1.96 KB
new1.41 KB
new126 bytes
new105 bytes
new107 bytes
new1.95 KB
new437 bytes
new350 bytes
new106 bytes
new1.07 KB
new1.09 KB
new1.14 KB
new1.27 KB
new962 bytes
new1.05 KB
new656 bytes
new3.92 KB
new235 bytes
new118 bytes
new141.43 KB
new141.97 KB
new186.33 KB

After some research, Smush.it claims to use PNGCrush for optimizing. Yahoo's Exceptional Performance group also recommended using pngout, optipng, and pngrewrite to find lossless savings. Google recommends OptiPNG or PNGOUT. ImageOptim has them all except pngrewrite, but has AdvPNG instead.

Only the following images were better through Smush.it: druplicon.png, mask.png, watchdog-ok.png, so I'm attaching those again to make it easier to discuss a group. Otherwise, these attachments are all new.

ImageOptim even found some savings over #511114: Use smaller feed.png image for feed.png, so here's the big list. Note ImageOptim has an Again button to do it all over again for additional savings. The algorithms can improve on themselves it seems.

Fun fact: ImageOptim on one run found 21.6% savings on the second and third screenshots taken and saved with Skitch.

First run
screenshot of ImageOptim output
Second run
screenshot of ImageOptim output
Third run
screenshot of ImageOptim output

deekayen’s picture

Status: Needs work » Needs review

The sum of the changes takes the size of all misc PNGs from 152k to 144k.

sivaji_ganesh_jojodae’s picture

I have already created an issue regarding this #543888: use compressed images in drupal core but this seems to have better description so let me mark that as duplicate.

catch’s picture

Issue tags: +Performance

Tagging. If we don't lose anything visually, seems no reason not to do this.

Bojhan’s picture

I can't really be bothered to compare every single image. Would be nice if would have supplied an comparison chart. But yhea, as catch said - if there is no visual difference, its good to go

mcrittenden’s picture

Wouldn't expect there to be any loss resulting from PNG optimization programs like those, so I'm for it. Subscribe.

deekayen’s picture

mcrittenden’s picture

Has my vote. Anybody else so we can RTBC?

figaro’s picture

I am doubtful whether this will make a noticeable difference, even for sites with pages that are heavily reliant on the icon set. We should instead bank on a CSS sprites approach and optimise the icon set there. Time is spent in HTTP requests instead of actual transfer for files this size. Someone with a different theme and icon set will have to redo this optimisation. Even so, it doesn't harm to have this in.

deekayen’s picture

The goal here is not really performance as catch tagged it. We're really only talking about a couple of bytes per image. It's not hugely significant there.

My reason for going through this issue is because every time someone runs YSlow or Google Page Speed to optimize their site, they're going to get notified that their site could be faster if they had used compressed or optimized images, then it will list these images and their compressed options.

When I start thinking about having to swap out core files on my production site to make error messages go away and get a nice clean report, things start leaking out my ears. That's my reasoning. If people think it's also a performance issue, that's fine as well, but even I'll loudly proclaim that's not a great argument on its own.

Google and Yahoo are investing a lot of money in their performance teams, so I expect Page Speed and YSlow have enough users to make this worthwhile in just making Drupal look good that it passes their tests. Latest stat: 1,309,372 downloads of YSlow - note Smush.it is plugged repeatedly on the add-ons page.

mcrittenden’s picture

Status: Needs review » Reviewed & tested by the community

it doesn't harm to have this in.

Exactly. RTBC.

webchick’s picture

Just quickly, deekayen can you confirm that said warnings from Google Page Speed go away once you put the images this patch? I only saw a "before" screenshot, not an "after".

And thanks a lot for taking the time to lay out before/after images!

webchick’s picture

Additionally, let's make sure we have this procedure documented somewhere so whenever a new image is added to core we can make sure this tool has been run on it. It's useful for contributed modules as well.

deekayen’s picture

More screenshots. I uploaded all the proposed in #2 to http://deekayen.net/misc if anyone wants to try it themselves. The DA icon is cached on Coral, so it'll take some time to update. Smush.it is being slow, so I got impatient and took screenshots before it finished processing all of the images, but it shows the feed.png result.

catch’s picture

@figaro CSS sprites are a good idea, but we'd need something which generates them - adding a sprite to core is a maintenance nightmare. I don't think this'll make any measurable performance difference either, but it's good to have clean reports from those tools, so that when something shows up which is an actual problem, it's not obscured by the noise.

dries’s picture

Sprites are good when you display many of its images on one page. In this case, a lot of the images are displayed on different pages, which could make sprites sub-optimal. Imagine you only want to use a single image of the sprint ...

FiReaNGeL’s picture

Thats not 100% true Dries - remember that images are cached, so you would download it once and that would save http requests on other subsequent pages, assuming that the user actually visit multiple pages. Anyway, I think it wouldn't be a good idea to implement anyway - for logistic issues. We could always adopt an automated sprite generator to fix the logistic issue, though.

dries’s picture

Fair enough, good point. Most websites have bounce rates of 50% and more so it could still be sub-optimal. ;-)

I'm happy to commit this "patch" but it is a bit time consuming to have to download all of these images. Happy to do so after code freeze though.

Packing them as a single zip file would help a bit.

deekayen’s picture

The last attachment on #2 is "misc.tgz of all the images".

figaro’s picture

Just to keep the focus on what this issue is about:
1- Avoiding a repeat alert on a tool that is maintained outside drupal (#18)
2- Having a process in place that ensures that this issue does not regress (#16)

I am happy to propose some text to our documentation team, if someone is willing to point out which page(s) this concerns. At the same time, it would help to have similar guidelines for the Drupal theming guide and I would like to propose the best practices guide (http://drupal.org/node/37156). Despite #21, no change in status.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

figaro’s picture

Status: Closed (fixed) » Needs review

Closed it may be, I have yet added the Smush suggestion to the following page: http://drupal.org/node/37156
Please review.

deekayen’s picture

Status: Needs review » Needs work

What you had looked fine, even though I tacked on a few more links. It's a little weird to be on the HTML and CSS page. Is there a better place?

marcingy’s picture

Status: Needs work » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Fixed

I think this works for now. Thanks!

wim leers’s picture

Simple, yet great change :)

For the people who end up reading this issue and are interested in optimizing *all* the images on their site *automatically* (and optionally syncing them to a CDN): use the CDN integration module in combination with the File Conveyor daemon.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

andypost’s picture

XiaN Vizjereij’s picture

Priority: Normal » Major
Status: Closed (fixed) » Active

As we are getting close to the UI freeze in RC1, can anyone please recheck this for beta3 again ... or even better as a last step before getting out RC1?

http://pornel.net/imageoptim/en is not available for for windows, else i would do it :(

philbar’s picture

Priority: Major » Normal
Status: Active » Closed (fixed)

Please use the following issue:
#935122: Compress Images using Lossless Techniques

It has the proper instructions for converting all the images in Drupal core quickly.

deekayen’s picture

Crossposting for people who want to compress jQuery UI's images.

I intentionally left jQuery images out of this and its other followup issues. Drupal manages images in most places like Bartik, which makes future maintenance of all its changes our problem. I think modifying the jQuery image files makes them a fork and that if you want those to be optimized to submit the compressed versions to the jQuery UI project, not to Drupal.

philbar’s picture

Status: Closed (fixed) » Reviewed & tested by the community
StatusFileSize
new24.36 KB

Excluding Jquery UI there are still a dozen images needing compression.

I've compressed and attached the remaining images which need compressing. They are not in the exact directory hierarchy, but are in folders based on theme which they reside.

For the jQuery UI, I've created a git branch and recommended the improvement in their project version control:
https://github.com/jquery/jquery-ui/pull/41

philbar’s picture

Committed to jQuery UI:
https://github.com/jquery/jquery-ui/commit/ff4154bb5d5a463cdb1750745b05e...

If we can get #36 in we can close this issue.

XiaN Vizjereij’s picture

And before we close that issue, we need a way to make sure that all drupal's cvs committed images get optimized before.

But nice one on the jquery stuff :D !

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed #36 to HEAD. Thanks!

At BADCamp, there was some concern from the Bartik maintainers that smushed images might remove transparency that previously existed? Except when Tim went digging, he wasn't able to actually find hard evidence of this. But that's the only potential reason to back out any of these changes. We'll see if this breaks anything, but in clicking around everything seemed copasetic.

Status: Fixed » Closed (fixed)
Issue tags: -Performance

Automatically closed -- issue fixed for 2 weeks with no activity.