etxztn / pulpcore

Automatically exported from code.google.com/p/pulpcore
0 stars 0 forks source link

Allow compression level to be passed into PNGWriter #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It would be nice to allow the setting of the compression level when using
PNGWriter instead of defaulting to no compression.

I've attached a patch that will add a second (optional) parameter to the
PNGWriter.write method. The value for this second parameter can be any of
the compression levels found in "Deflater". The default is no compression.

Original issue reported on code.google.com by daniel.watling on 9 Nov 2009 at 6:57

Attachments:

GoogleCodeExporter commented 8 years ago
This is incorrect because the PNG format specifies "At present, only 
compression method 0 (deflate/inflate 
compression with a sliding window of at most 32768 bytes) is defined.". So, 1) 
the default should use 
Deflater.DEFAULT_COMPRESSION  and 2) the compression method byte should always 
be 0. Also, the new write() 
method should throw an exception if the compression level is not 1-9 or -1.

Unfortunately, even with compression level 9, the compression won't be as good 
as the PNG encoder provided in 
tools/assettools/png which does analysis and optimization.

Original comment by brack...@gmail.com on 9 Nov 2009 at 11:06

GoogleCodeExporter commented 8 years ago

Original comment by brack...@gmail.com on 8 Mar 2010 at 9:18