JDK-6488522 : PNG writer should permit setting compression level and iDAT chunk maximum size
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-10-31
  • Updated: 2017-01-18
  • Resolved: 2015-12-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 9
9 b105Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
Currently the PNG compression level and iDAT chunk size are not mutable via the API. Not being able to set the iDAT size is a problem for some customers as evidenced by this issue:

https://jai-imageio-core.dev.java.net/issues/show_bug.cgi?id=95

Currently in jai-imageio the compression level and other items are settable as described here:

http://download.java.net/media/jai-imageio/javadoc/1.1/overview-summary.html#PNGImageWriteParam

Comments
FYI, Daniel Gredler <djgredler at gmail.com> made a small backport library that provides the fix and works in Java 7 and Java 8: https://github.com/gredler/jdk9-png-writer-backport Laurent
2016-08-01

Could you sponsor this important bug fix, please ?
2015-12-10

What means "set the iDAT chunk size" ? I did not change anything concerning buffers. Does it seem possible to backport this fix to JDK 8 updates ?
2015-12-10

RFR: http://mail.openjdk.java.net/pipermail/2d-dev/2015-December/006039.html
2015-12-09

I looked at PNGImageWriter class and will work on a patch soon. Actually the Deflater is very time consuming as it uses the maximum compression (level 9): Deflater def = new Deflater(Deflater.BEST_COMPRESSION) I quickly tested several Deflater compression levels [0 to 9] on some huge map images: * total size: * level 1: 49.9 Mb * level 3: 46.9 Mb * level 4: 40.7 Mb * level 9: 37 Mb * write PNG time (most complex image) : * level 1: 8211 ms * level 3: 7793 ms * level 4: 9450 ms * level 9: 23562 ms I would choose by default the level 4 to have the best compromise between speed vs time.
2015-12-02

Please re-open if - if fix is in progress or on the plan to fix soon - if this is a P3 (file as P3, not P4)
2014-03-18

SUGGESTED FIX Create a new ImageWriteParam subclass javax.imageio.plugins.png.PNGImageWritePatam which has a mutator and accessor for the compression level and the iDAT maximum size. The default iDAT size should be 8192 to match libpng.
2006-10-31