Incorrect png -quality 9 setting gives the best compression
Posted: 2013-09-21T16:02:53-07:00
If I use -quality 9 I get extraordinary compression but the docs don't specify what is mogrify's behaviour with such input value so I don't know if I'm getting a valid result.
I have 26 TIFF images for testing, some 8 bit greyscale, some 24 bit color.
If I compress using the default quality (which is 75) I get 444.566.700 bytes.
If I use -quality 96 I get 354.773.171 which is great.
If I use -quality 9 I get 338.673.832 which is unbeatable by any other switch combination I tried.
Checking file by file between quality 96 and quality 9 I get -quality 9 gives me 23 smaller files and 3 bigger. Smaller files are on avegare 3.65% smaller and bigger ones are on average 0.08% bigger.
Looking at the logs with -debug all I see
Setting up deflate compression
Compression buffer size: 32768
Compression mem level: 9
Compression strategy: 2
Setting up filtering
Base filter method: 9
But
gives me 568.640.145 which is huge. Those param values are consistent with the sources as far as I could see.
So I'm not sure what compression-level compression-strategy and compression-filter are being used with -quality 9.
Maybe someone with more source code knowledge can tell me what goes on with -quality 9 and if it is ok to use it...
I have 26 TIFF images for testing, some 8 bit greyscale, some 24 bit color.
If I compress using the default quality (which is 75) I get 444.566.700 bytes.
If I use -quality 96 I get 354.773.171 which is great.
If I use -quality 9 I get 338.673.832 which is unbeatable by any other switch combination I tried.
Checking file by file between quality 96 and quality 9 I get -quality 9 gives me 23 smaller files and 3 bigger. Smaller files are on avegare 3.65% smaller and bigger ones are on average 0.08% bigger.
Looking at the logs with -debug all I see
Setting up deflate compression
Compression buffer size: 32768
Compression mem level: 9
Compression strategy: 2
Setting up filtering
Base filter method: 9
But
Code: Select all
mogrify -depth 8 -format png -define PNG:compression-level=9 -define PNG:compression-strategy=2 -define PNG:compression-filter=9 -path "$DST" "$SRC"/*.tif
So I'm not sure what compression-level compression-strategy and compression-filter are being used with -quality 9.
Maybe someone with more source code knowledge can tell me what goes on with -quality 9 and if it is ok to use it...