Re: [PNG] Cancel upcoming meeting?

I was unable to get either oxipng or pngcrush to do what I wanted; to
just use selected groups of filters.  I ended up using pngcp linked
against both libpng-1.6 and libpng-1.7, the latter allowing me to use
the tuned approaches to compression that I worked out for 1.7.

Just quoting the results for the optimal filter setting and the
results when I restricted the filter to SUB I got:

OPTIMAL:
  libpng-1.6 43.4683% (16'410'529 bytes) SUB+UP+AVG, Z_FILTERED with a
512byte window
  libpng-1.7 43.5607% (+0.0924%) (16'445'394 bytes) AVG, Z_HUFFMAN_ONLY

SUB filter only:
  libpng-1.6 46.1208% (+2.6525%) (17'411'911 bytes) Z_FILTERD with a
512byte window
  libpng-1.7 46.1926% (+2.7243%) (17'438'999 bytes) Z_HUFFMAN_ONLY

So there is a cost of dropping AVG; for this image AVG on its own is
pretty much optimal in both libpng-1.6 and libpng-1.7 plus it has the
advantage of not requiring any heuristic evaluation which does speed
up compression a bit.

However the most interesting thing for me is that libpng-1.7 achieved
optimal results using Z_HUFFMAN_ONLY and that does not require a
window at all!  Likewise with libpng-1.6 Z_FILTERED *does* come out
best but the window used, 512 bytes, is the smallest zlib supports.
Some things which might seem to obviously make size "no worse" do, in
fact, make it worse.  Using ZLIB compression level "9" (my 1.6 tests
ended up with level 8) or increasing the window size both reduce
compression with libpng-1.6.

The actual size increase in restricting zlib to just using Huffman
coding is minute but the advantages can be enormous; Huffman coding is
very fast on both encode and decode, plus it doesn't require a window
so it has a smaller memory footprint.

Nevertheless these kind of tests are specific to the image and to the
algorithms used in the optimizer; pngcp is fairly crude and a simple
run of oxipng produced output of 16'219'025 bytes, which is
compression to 42.9611%, 0.5072% better than the pngcp searches.  The
oxipng output used AVG,UP and SUB (1 SUB for the first row).

John Bowler <jbowler@acm.org>

Received on Saturday, 10 May 2025 17:38:19 UTC