[ubuntu-art] Recompressing PNGs to save space?

Frank Schoep frank at ffnn.nl
Wed Apr 26 20:30:20 BST 2006

On Tuesday 25 April 2006 11:00, Frank Schoep wrote:
> ...
> To summarize: before we make any decisions on my initial analysis I'd like
> to investigate the correctness of the numbers I provided, I hope this won't
> pose a problem. The timespan for this is about two or three days.
> ...

Today I've finished my new analysis and I'm presenting the results here, first 
of all the summarized conclusions, then a bit more background information and 
at the bottom of this email are the raw numbers to base my report on.

Brief Summary
By removing duplicate images and recompressing all image files we can save 
about 21 megabytes in the uncompressed default Dapper installation and shave 
off anywhere from 11 to 21 megabytes from the installation CD. This last 
figure depends on the unpredictable actual compression ratio of the package 
file format.

Detailed Summary
There are 12114 filenames matching the PNG extension, of which 9420 are actual 
files, 2694 are symbolic links. I ignored symbolic links in the calculations 
because they do not take up "space" themselves and can not be optimized 
further for distribution.

In the current situation, all 9420 image files take up a total of 50 Mb 
uncompressed and 39 Mb compressed (bzip2).

To save space I first checked for duplicate images, there were 1888 (!) binary 
duplicate images in the default installation which could easily be replaced 
by symlinks saving about 8 Mb.

Next up I tried recompressing the remaining unique images, this shrunk the 
uncompressed size from 42 Mb to 29 Mb, the compressed size shrunk from 35 Mb 
to 29 Mb.

I actually experimented with different OptiPNG settings because the initial 
recompression time was over 10 hours: using the default optimization level, 
recompression time dropped to half an hour for all 7531 unique images and the 
compression ratio was almost the same (neglible difference).

Raw Statistics
Dapper Beta with updates on April 25th, 2006

12114 filenames matching *.png in /usr
9420 actual files
2694 symbolic links

9420 actual files, 50.745.810 bytes
7531 unique files, 42.740.715 bytes
1888 duplicates, 8.005.095 bytes

Original files including dupes, 50.745.810 bytes
Original unique files, 42.740.715 bytes
Recompressed (fast) unique files, 29.567.194 bytes
Recompressed (max) unique files, 29.357.713 bytes

Original files including dupes tar-bzip2'ed, 39.161.467 bytes
Original unique files tar-bzip2'ed, 34.905.515 bytes
Recompressed (fast) unique files tar-bzip2'ed, 28.892.262 bytes
Recompressed (max) unique files tar-bzip2'ed, 28.911.620 bytes

Time taken for recompression (fast): about 30 minutes
Time taken for recompression (max): about 10 hours

Final Words
I hope this more thorough provides a starting point for a discussion on the 
idea of recompressing PNGs in Ubuntu. I'd be happy to provide more 
information on the methods and tools I used to generate the results and I'd 
gladly help out adapt package build processes to automatically optimize PNGs.

If it is useful I would be able to provide a list of all duplicate images 
found in the current Dapper installation so that these can be replaced by 

With kind regards,

Frank Schoep

(Apologies for cross-posting, but I'm not sure on which list to send this to, 
if you have strong objections to this, please notify me!)

More information about the ubuntu-art mailing list