[ubuntu-art] Recompressing PNGs to save space?

Frank Schoep frank at ffnn.nl
Mon Apr 24 22:47:54 BST 2006

Hi all,

I've been fiddling around with the Dapper beta release and I tried an 
experiment with the graphics data included with it.

I used a simple "find" statement and a Bash script to copy over all PNG images 
in the default installation and recompressed all these images using a 
combination of PNGRewrite, OptiPNG and AdvancePNG to see if there was any 
space to be saved, the results of the recompression are as follows:

- original PNGs apparent bytes: 53.636.628
- recompressed apparent bytes: 38.185.898
- apparent bytes saved: 15.450.730

So, recompressing all distributed PNGs would save just over 15 megabytes in 
the actual default installation. The results can also be expressed in 
disk-blocks, since small files often take up a whole disk block the results 
are quite surprising:

- original PNGs disk-blocks: 86.428
- recompressed disk-blocks: 72.012
- disk-blocks saved: 14.416

Looking at it this way, the recompression would save about fourteen and a half 
thousand disk blocks. I also looked at how well the original and recompressed 
PNGs would be archived using BZIP2:

- original PNGs bzip2 archive in bytes: 40.028.323
- recompressed PNGs bzip2 archive: 32.109.940
- archived bytes saved: 7.918.383

So, looking at the archived versions we can save eight megabytes by 
recompressing the PNGs.

My actual question is this: is it worth it to optimize all PNGs by 
recompressing them? It doesn't affect the appearance or content, it only 
makes each file as small as possible.

By doing this, we could probably trim about seven megabytes off the install CD 
(which amounts to 1% of the total size) and we can cut 15 megabytes off the 
required hard disk space for installation. I think that because of the 
smaller file sizes, there's also an actual performance benefit here (or is it 

To give an indication on the amount of time required for recompression: it 
took my Athlon 64 3200+ about 24 hours to recompress all PNGs included in the 
Dapper beta default desktop installation.

Another proposition would be to build an automated PNG optimizer so that all 
PNG in packages are automatically recompressed without any user intervention.

I hope my research interests some of you, if anything was unclear I'd be happy 
to explain more of the process and the results. Just ask away!

With kind regards,

Frank Schoep

More information about the ubuntu-art mailing list