Huffmix compares two PNG files produced by PNGOUT in random mode and cherry-picks the smallest deflate blocks to combine them into a new file.
PNG compression is based on Deflate (by Phillip Katz, first introduced in PKZIP). A deflate stream is made of one or more blocks.
Ken Silverman's PNGOUT is a powerful PNG optimization tool based on its own deflate algorithm (not the commonly used zlib)
- PNGOUT lets you choose how many blocks it produces (-n option, or -b to set the block split threshold).
- PNGOUT has a random switch (-r randomized initial tables "good for many trials with same options").
For instance if we have 3 blocks.
block 1: 110 bits
block 2: 317 bits
block 3: 272 bits
Overall: 699 bits
block 1: 104 bits
block 2: 312 bits
block 3: 289 bits
Overall: 705 bits
Until now you would have kept File A and deleted File B (since A is smaller than B), Huffmix combines File A and File B into File C by picking the smallest blocks, this gives:
block 1: 104 bits (from File B)
block 2: 312 bits (from File B)
block 3: 272 bits (from File A)
Overall: 688 bits
We end up with a smaller file and managed to take profit of the calculations done to produce the biggest file, it works like a catalyst.
Of course since there's randomness involved it will not always work as demonstrated, nevertheless my first tests suggests that it actually works pretty well.
- Linux i686 (32 bits)
- Linux x64 (64 bits)
- Mac OS X PowerPC & Intel
- Windows NT/2000/XP/Vista/7
Current version notes:
-k Keep same block structure as in first file
- Asymmetric block support
- First version released
Last update: 14 September 2011 by Frederic Kayser