[OpenJDK 2D-Dev] RFR 6488522: PNG writer should permit setting compression level and iDAT chunk maximum size

Laurent Bourgès bourges.laurent at gmail.com
Wed Dec 9 14:17:13 UTC 2015


Hi Sergey,

Thanks for your comments, did you review the PNGImageWriter changes too ?

2015-12-09 14:19 GMT+01:00 Sergey Bylokhov <Sergey.Bylokhov at oracle.com>:

> Hi, Laurent.
> Should the test check the resulted image in the file? At least it can
> check that the CompressionMode is not ignored and the saved files have
> different size/content for different modes?
>

Yes, I could check that every png file is not zero-length or that better
compression gives smaller file size !

FYI I manually checked generated files: images are OK (readable by firefox)
and file sizes are correct:

-rw-rw-r-- 1 bourgesl bourgesl   4014 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.0.png
-rw-rw-r-- 1 bourgesl bourgesl   4137 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.1.png
-rw-rw-r-- 1 bourgesl bourgesl   5046 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.2.png
-rw-rw-r-- 1 bourgesl bourgesl   5051 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.3.png
-rw-rw-r-- 1 bourgesl bourgesl   6322 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.4.png
-rw-rw-r-- 1 bourgesl bourgesl   7431 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.5.png

*-rw-rw-r-- 1 bourgesl bourgesl   7431 déc.   9 13:19
PNGWriterCompressionTest-default.png*-rw-rw-r-- 1 bourgesl bourgesl   7431
déc.   9 13:19 PNGWriterCompressionTest-explicit-0.6.png
-rw-rw-r-- 1 bourgesl bourgesl   8292 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.7.png
-rw-rw-r-- 1 bourgesl bourgesl   8890 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.8.png
-rw-rw-r-- 1 bourgesl bourgesl  10563 déc.   9 13:19
PNGWriterCompressionTest-explicit-0.9.png
-rw-rw-r-- 1 bourgesl bourgesl 250437 déc.   9 13:19
PNGWriterCompressionTest-explicit-1.0.png

*-rw-rw-r-- 1 bourgesl bourgesl 250437 déc.   9 13:19
PNGWriterCompressionTest-disabled.png*
However, my changes rely on the public Deflater API that supports
compression levels between 0 to 9.

I suppose that this Deflater class is already covered by its own tests so I
would prefer leaving the test as it is (no verification):  if the Deflater
raises any RuntimeException, then the PNGWriterCompressionTest will fail.

Also I think in the test we can cover all plugins which
> canWriteCompressed=true?
>

Why not but it is a different scope ?

I wrote the test focused on testing my patch to validate all my changes and
fix ASAP that very old bug (created in 2006) !

Moreover, I do not really know other imageio writers (jpg, bmp, tiff ...) !
Maybe other compression tests could be derived from the
PNGWriterCompressionTest class and I think it should be part of other bugs.

Regards,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20151209/accfa48e/attachment.html>


More information about the 2d-dev mailing list