Open Bug 473791 Opened 16 years ago Updated 2 years ago

Optimized PNG files for TB icons

Categories

(Thunderbird :: General, enhancement, P3)

enhancement

Tracking

(Not tracked)

ASSIGNED
Thunderbird 7.0

People

(Reporter: gkw, Assigned: f.kayser)

Details

(Keywords: perf)

Attachments

(1 file)

From https://bugzilla.mozilla.org/show_bug.cgi?id=397522#c33

"The past 5 or 6 icon drops have included loss-less compression with optipng
0.5.5, and testing with pngcheck 1.99.3 as part of the automated process of
generating the icon drop."

Firefox has had their PNG icons losslessly compressed without significant performance penalties so I reckon the same should be done for Thunderbird's icons. Past discussions regarding its advantages/disadvantages are at the bug above, the general consensus seems to be a perf win. See:
https://bugzilla.mozilla.org/show_bug.cgi?id=397522#c17
https://bugzilla.mozilla.org/show_bug.cgi?id=397522#c25

xref bug 386973, a related bug I filed some time ago for TB2.
Flags: wanted-thunderbird3?
Seems like a win, what steps need to be done?
(In reply to comment #1)
> Seems like a win, what steps need to be done?

If we're going to have an icon drop from some source, it can be optipng'ed at the source, as Faaborg as mentioned in that bug.

Else, we should run GIMP on every PNG file we have, convert to use index format (<=256 colors) for images with less than 256 colors (definite win) or use a higher compression level on each (not-so-guaranteed win). Examples of programs that can reduce sizes of PNG files are pngcrush, pngout, optipng or something.

CC'ing faaborg and Glenn as they seem to have expertise in this area and perhaps can offer some advice on this issue.
Another example here:

pngcrush -rem alla -brute in.png out.png

https://bugzilla.mozilla.org/show_bug.cgi?id=397522#c31
(In reply to comment #3)
> Another example here:
> 
> pngcrush -rem alla -brute in.png out.png
> 
> https://bugzilla.mozilla.org/show_bug.cgi?id=397522#c31

Right, but as mentioned above the in.png should be reduced to
indexed color type first.  You can use the GIMP, ImageMagick, GraphicsMagick,
or pngquant to do that.  The -alla parameter is only a good thing if you know that the input image is in sRGB colorspace,  because it will remove colorspace info.
I ran optipng over the whole theme dir at some point, but IIRC there wasn't any significant gain.

That said, this isn't much work, so we should do it. (If the numbers say it's worth it.)
Flags: wanted-thunderbird3? → wanted-thunderbird3+
Priority: -- → P3
Target Milestone: --- → Thunderbird 3.0rc1
(In reply to comment #5)
> I ran optipng over the whole theme dir at some point, but IIRC there wasn't any
> significant gain.
> 
> That said, this isn't much work, so we should do it. (If the numbers say it's
> worth it.)

Magnus what were the numbers ?
Didn't write it down last time

 $ find mail/themes/gnomestripe/ -iname *.png | xargs optipng -o 9

The change is about nothing, around 0.2 percent, at least for the gnomestripe theme.
about-background.png
about-logo.png
about-wordmark.png
about.png
icon48.png
icon64.png
Attachment #534947 - Flags: review?
Comment on attachment 534947 [details] [diff] [review]
[checked in] Size optimized PNG files, everything in /comm-central/mail/branding/nightly/content/

bwinton is our Thunderbird UI guru..
Attachment #534947 - Flags: review? → review?(bwinton)
Fred how much are we gaining on the omnijar file when using these files compared to the ones you are providing ?
Since PNG files are really hard to recompress most of the time they are simply stored in .zip/.jar archives*. The gain should be in the same ballpark as the sum of the gain for each file.

41249 -> 29753, 11496 bytes smaller (about-background.png)
27840 -> 24502,  3338 bytes smaller (about-logo.png)
20420 -> 17107,  3313 bytes smaller (about.png)
 4603 ->  4069,   534 bytes smaller (icon64.png)
 3190 ->  2705,   485 bytes smaller (about-wordmark.png)
 3171 ->  2789,   382 bytes smaller (icon48.png)

Total gain : 19548 bytes

*this can be checked running "unzip -v omni.jar"

== Current images == (omni.jar from yesterday Nightly Build)
Length  Method   Size  Cmpr  Name
------  ------  ------ ----  ----
 27840  Defl:X   27804   0%  about-logo.png
 41249  Defl:X   40836   1%  about-background.png
  4603  Stored    4603   0%  icon64.png
  3190  Stored    3190   0%  about-wordmark.png
 20420  Defl:X   20349   0%  about.png
  3171  Stored    3171   0%  icon48.png

== Optimized images == (zip archive produced by kzip, this is not the tool used in the build chain, but Info-Zip produces nearly the same)
Length  Method   Size  Cmpr  Name
------  ------  ------ ----  ----
 24502  Defl:X   24471   0%  about-logo.png
 29753  Defl:X   29324   1%  about-background.png
  4029  Stored    4029   0%  icon64.png
  2705  Defl:X    2053  24%  about-wordmark.png
 17107  Defl:X   17070   0%  about.png
  2789  Stored    2789   0%  icon48.png
Comment on attachment 534947 [details] [diff] [review]
[checked in] Size optimized PNG files, everything in /comm-central/mail/branding/nightly/content/

It's not a huge savings, but it is some savings, and it's very low cost, so why not, right?  r=me.
Attachment #534947 - Flags: review?(bwinton) → review+
Assignee: nobody → f.kayser
Status: NEW → ASSIGNED
Keywords: checkin-needed
Comment on attachment 534947 [details] [diff] [review]
[checked in] Size optimized PNG files, everything in /comm-central/mail/branding/nightly/content/

Checked in: http://hg.mozilla.org/comm-central/rev/57310aa503db

My only concern at this stage is that we should get some documentation on how this is done, and how to tell it needs doing. Otherwise I can just see this getting undone over a period of time.
Attachment #534947 - Attachment description: Size optimized PNG files, everything in /comm-central/mail/branding/nightly/content/ → [checked in] Size optimized PNG files, everything in /comm-central/mail/branding/nightly/content/
Keywords: checkin-needed
Target Milestone: Thunderbird 3.0rc1 → Thunderbird 7.0
fred are you scripts available somewhere ?
(In reply to Ludovic Hirlimann [:Usul] from comment #14)
> fred are you scripts available somewhere ?
Flags: needinfo?(f.kayser)
(In reply to Wayne Mery (:wsmwk) from comment #15)
> (In reply to Ludovic Hirlimann [:Usul] from comment #14)
> > fred are you scripts available somewhere ?

Nowadays one of the best way to optimize PNGs is to use ScriptPNG (Windows) http://css-ig.net/scriptpng but ZopfliPNG ("make zopflipng" in the Google Zopfli project) is also a strong contender (source from last summer is needed https://code.google.com/p/zopfli/source/list not the old release from 2013).
Flags: needinfo?(f.kayser)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: