Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-alpha2
-
None
Description
I propose to enhance the PngWriter class and PngImagingParameters class to allow the use of predictors. This change should reduce the size of output images written in PNG format. The resulting images will carry exactly the same data. There will be no loss of pixels or image quality. But the results will be smaller than those currently produced by either Imaging or Java's ImageIO class.
Background
The PNG specification permits the use of optional predictors as part of its data compression logic. Predictors are applied through the use of a filter that transforms the data before it is passed to the conventional Deflate data compressor. In some cases, predictors can result in a 30 percent reduction of file size. They are particularly suited to photographic images. Although they will work on graphics and line art, the reduction is often more modest.
You can find a description of predictors on Wikipedia
The Java ImageIO class does not apply predictors as part of its processing. Consequently, if you write an image from a Java application using ImageIO, pull the image into Paint, and then save it under another name, the size of the image may actually decrease. So when this feature is added to Commons Imaging, it will out perform ImageIO when writing PNGs.