Smush core images

deekayen - August 18, 2009 - 04:02
Project:Drupal
Version:7.x-dev
Component:base system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:Performance
Description

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.

AttachmentSizeStatusTest resultOperations
menu-collapsed-rtl.png108 bytesIgnoredNoneNone
menu-leaf.png137 bytesIgnoredNoneNone
arrow-desc.png118 bytesIgnoredNoneNone
draggable.png262 bytesIgnoredNoneNone
druplicon.png3.92 KBIgnoredNoneNone
forum-closed.png1.07 KBIgnoredNoneNone
forum-hot-new.png1.29 KBIgnoredNoneNone
forum-new.png1.11 KBIgnoredNoneNone
grippie.png108 bytesIgnoredNoneNone
tree-bottom.png936 bytesIgnoredNoneNone
tree.png939 bytesIgnoredNoneNone
watchdog-error.png780 bytesIgnoredNoneNone
watchdog-ok.png411 bytesIgnoredNoneNone
watchdog-warning.png320 bytesIgnoredNoneNone
powered-black-135x42.png2.73 KBIgnoredNoneNone
powered-black-80x15.png1.42 KBIgnoredNoneNone
powered-black-88x31.png2.06 KBIgnoredNoneNone
powered-blue-135x42.png2.94 KBIgnoredNoneNone
powered-blue-80x15.png994 bytesIgnoredNoneNone
powered-blue-88x31.png2.05 KBIgnoredNoneNone
powered-gray-135x42.png2.64 KBIgnoredNoneNone
powered-gray-80x15.png741 bytesIgnoredNoneNone
powered-gray-88x31.png2 KBIgnoredNoneNone
marker.png503 bytesIgnoredNoneNone
mask.png1.95 KBIgnoredNoneNone
wheel.png11.44 KBIgnoredNoneNone

#1

deekayen - August 18, 2009 - 04:54
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.

#2

deekayen - August 18, 2009 - 05:54

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

AttachmentSizeStatusTest resultOperations
misc_ImageOptim.png186.33 KBIgnoredNoneNone
misc_ImageOptim_secondrun.png141.97 KBIgnoredNoneNone
misc_ImageOptim_thirdrun.png141.43 KBIgnoredNoneNone
arrow-desc.png118 bytesIgnoredNoneNone
draggable.png235 bytesIgnoredNoneNone
druplicon.png3.92 KBIgnoredNoneNone
feed.png656 bytesIgnoredNoneNone
forum-closed.png1.05 KBIgnoredNoneNone
forum-default.png962 bytesIgnoredNoneNone
forum-hot-new.png1.27 KBIgnoredNoneNone
forum-hot.png1.14 KBIgnoredNoneNone
forum-new.png1.09 KBIgnoredNoneNone
forum-sticky.png1.07 KBIgnoredNoneNone
grippie.png106 bytesIgnoredNoneNone
help.png350 bytesIgnoredNoneNone
marker.png437 bytesIgnoredNoneNone
mask.png1.95 KBIgnoredNoneNone
menu-collapsed-rtl.png107 bytesIgnoredNoneNone
menu-collapsed.png105 bytesIgnoredNoneNone
menu-leaf.png126 bytesIgnoredNoneNone
powered-black-80x15.png1.41 KBIgnoredNoneNone
powered-black-88x31.png1.96 KBIgnoredNoneNone
powered-black-135x42.png2.64 KBIgnoredNoneNone
powered-blue-80x15.png943 bytesIgnoredNoneNone
powered-blue-88x31.png1.96 KBIgnoredNoneNone
powered-blue-135x42.png2.81 KBIgnoredNoneNone
powered-gray-80x15.png698 bytesIgnoredNoneNone
powered-gray-88x31.png1.92 KBIgnoredNoneNone
powered-gray-135x42.png2.53 KBIgnoredNoneNone
tree-bottom.png129 bytesIgnoredNoneNone
tree.png130 bytesIgnoredNoneNone
watchdog-error.png780 bytesIgnoredNoneNone
watchdog-ok.png411 bytesIgnoredNoneNone
watchdog-warning.png320 bytesIgnoredNoneNone
wheel.png11.32 KBIgnoredNoneNone
misc.tgz43.89 KBIgnoredNoneNone

#3

deekayen - August 18, 2009 - 05:54
Status:needs work» needs review

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

#5

sivaji - August 18, 2009 - 09:07

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.

#6

catch - August 18, 2009 - 10:42

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

#7

Bojhan - August 18, 2009 - 10:51

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

#9

mcrittenden - August 18, 2009 - 14:20

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

#10

deekayen - August 18, 2009 - 14:22

Here are some screenshots for comparison.

AttachmentSizeStatusTest resultOperations
smushed_images-1.png185.82 KBIgnoredNoneNone
smushed_misc_onblack-2.png148.35 KBIgnoredNoneNone
index.html1.05 KBIgnoredNoneNone

#11

mcrittenden - August 19, 2009 - 14:40

Has my vote. Anybody else so we can RTBC?

#12

figaro - August 19, 2009 - 14:59

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.

#13

deekayen - August 19, 2009 - 15:17

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.

AttachmentSizeStatusTest resultOperations
page_speed_images.png70.53 KBIgnoredNoneNone

#14

mcrittenden - August 19, 2009 - 15:17
Status:needs review» reviewed & tested by the community

it doesn't harm to have this in.

Exactly. RTBC.

#15

webchick - August 19, 2009 - 16:31

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!

#16

webchick - August 19, 2009 - 16:32

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.

#17

deekayen - August 19, 2009 - 17:24

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.

AttachmentSizeStatusTest resultOperations
smush_result.png82.87 KBIgnoredNoneNone
page_speed_feed_icon-1.png70.37 KBIgnoredNoneNone
before_smush.png80.86 KBIgnoredNoneNone
Smush.it_yslow.png121.58 KBIgnoredNoneNone

#18

catch - August 21, 2009 - 23:55

@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.

#19

Dries - August 22, 2009 - 10:07

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 ...

#20

FiReaNG3L - August 23, 2009 - 04:03

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.

#21

Dries - August 23, 2009 - 10:07

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.

#22

deekayen - August 23, 2009 - 10:09

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

#23

figaro - August 23, 2009 - 13:48

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.

#24

Dries - August 23, 2009 - 14:24
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks!

#25

System Message - September 6, 2009 - 14:30
Status:fixed» closed

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

#26

figaro - September 7, 2009 - 18:40
Status:closed» needs review

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

#27

deekayen - September 7, 2009 - 18:57
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?

#28

marcingy - October 8, 2009 - 05:48
Status:needs work» reviewed & tested by the community

#29

webchick - October 9, 2009 - 07:50
Status:reviewed & tested by the community» fixed

I think this works for now. Thanks!

#30

Wim Leers - October 21, 2009 - 17:52

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.

#31

System Message - November 4, 2009 - 18:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.