Created attachment 28927 [details] the patch This patch includes two new PNG image loaders, one that uses the internal XGC PNG codec, and is very much equivalent to to the ImageIO image loader, and another that does not do the decoding of the PNG IDAT chunk and instead accepts the "raw" chunk. The image loaders are named, respectively, ImageLoaderPNG, and ImageLoaderRawPNG. For now these image loaders have a default penalty of 1000 so that the default image loader is still ImageLoaderImageIO. The ImageLoaderRawPNG has still some limitations on the type of PNG images that can handle. It only handles images with 8 bits per channel and without interlacing. Nevertheless, this image loader is particularly useful for large images encoded with the Paeth filter since it does not do the decoding (inverting the Paeth filter is very expensive). So besides being faster it also produces smaller output files.
Created attachment 28928 [details] test images attached are some test images to place in test/images. they are needed to run the unit tests. these images were obtained from here: http://www.schaik.com/pngsuite/
Note: for the record, this code, and the associated image handler for PDF in FOP, was initially prototyped by Matthias Reischenbacher and I built upon it. Thanks Matthias.
(In reply to comment #0) > Created attachment 28927 [details] > the patch > > This patch includes two new PNG image loaders, one that uses the internal > XGC PNG codec, and is very much equivalent to to the ImageIO image loader, > and another that does not do the decoding of the PNG IDAT chunk and instead > accepts the "raw" chunk. The image loaders are named, respectively, > ImageLoaderPNG, and ImageLoaderRawPNG. For now these image loaders have a > default penalty of 1000 so that the default image loader is still > ImageLoaderImageIO. > > The ImageLoaderRawPNG has still some limitations on the type of PNG images > that can handle. It only handles images with 8 bits per channel and without > interlacing. Nevertheless, this image loader is particularly useful for > large images encoded with the Paeth filter since it does not do the decoding > (inverting the Paeth filter is very expensive). So besides being faster it > also produces smaller output files. This introduces two deprecated use warnings when compiling. Could you fix? compile-java: [mkdir] Created dir: /users/glenn/Work/xgc/build/classes [javac] Compiling 290 source files to /users/glenn/Work/xgc/build/classes [javac] /users/glenn/Work/xgc/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java:279: warning: [deprecation] renderBitmapImage(java.awt.image.RenderedImage,float,float,float,float,org.apac\ he.xmlgraphics.ps.PSGenerator) in org.apache.xmlgraphics.ps.PSImageUtils has been deprecated [javac] PSImageUtils.renderBitmapImage(buf, [javac] ^ [javac] /users/glenn/Work/xgc/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java:650: warning: [deprecation] renderBitmapImage(java.awt.image.RenderedImage,float,float,float,float,org.apac\ he.xmlgraphics.ps.PSGenerator) in org.apache.xmlgraphics.ps.PSImageUtils has been deprecated [javac] PSImageUtils.renderBitmapImage(img, [javac] ^ [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 2 warnings
(In reply to comment #2) > Note: for the record, this code, and the associated image handler for PDF in > FOP, was initially prototyped by Matthias Reischenbacher and I built upon > it. Thanks Matthias. Given the substance of the patch, and assuming Matthias' contribution was substantial, could you ask Matthias to submit an ICLA [1] to cover his portion of the contribution? [1] http://www.apache.org/licenses/#clas
(In reply to comment #3) > > This introduces two deprecated use warnings when compiling. Could you fix? > Indeed! I had added the @deprecated myself since it seemed a good idea not to expose that method but since I cannot make a very strong case and there are side effects that I had missed I will remove it.
Created attachment 28931 [details] patch to replace previous one the @deprecated keyword was removed
(In reply to comment #6) > Created attachment 28931 [details] > patch to replace previous one > > the @deprecated keyword was removed thanks; as soon as Matthias' ICLA is registered at [1] i will apply this and the related fop patches [1] http://people.apache.org/committer-index.html#unlistedclas
(In reply to comment #7) > (In reply to comment #6) > > Created attachment 28931 [details] > > patch to replace previous one > > > > the @deprecated keyword was removed > > thanks; as soon as Matthias' ICLA is registered at [1] i will apply this and > the related fop patches > > [1] http://people.apache.org/committer-index.html#unlistedclas I've just sent my ICLA to secretary. Thanks Luis for doing all the hard work and finishing this feature. It finally fixes a long standing problem. Thanks!
patch applied at http://svn.apache.org/viewvc?rev=1350450&view=rev thanks Luis & Matthias! please review and close if satisfied
Created attachment 29131 [details] support for sRGB and iCCP chunks this new patch improves the previous one by adding support for the sRGB and iCCP PNG chunks to the ImageLoaderRawPNG.
applied: http://svn.apache.org/viewvc?view=revision&revision=1400525