|
Size: 2073
Comment:
|
← Revision 3 as of 2012-06-15 14:16:50 ⇥
Size: 2059
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| The ImageLoaderRawPNG is not selected (it has an intrinsic penalty of 1000) by default since it does not handle all kinds of PNG images. As of this writing it only supports images with 8 bits per channel (which are most of the PNG images), without interlacing. To enable the image loader a negative penalty needs to be awarded to the image loader in the FOP configuration file (fop.xconf): | The ImageLoaderRawPNG is not selected (it has an intrinsic penalty of 1000) by default since it does not handle all kinds of PNG images. As of this writing it only supports images with 8 bits per channel (which are most of the PNG images), without interlacing. To enable the image loader a negative penalty needs to be awarded to it in the FOP configuration file (fop.xconf): |
XMLGraphicsCommons includes an image loader for raw PNG. This means the PNG bytes from the IDAT chunk can be embedded in the output format (PDF and PS for now) without the need to decode them. Note that usually the decoding would revert the filter applied to the image bytes (this is a filter applied before compression to make the PNG files smaller) resulting in larger files and sometimes a performance impact (reverting some filters, in particular the Paeth filter, is generally expensive).
The ImageLoaderRawPNG is not selected (it has an intrinsic penalty of 1000) by default since it does not handle all kinds of PNG images. As of this writing it only supports images with 8 bits per channel (which are most of the PNG images), without interlacing. To enable the image loader a negative penalty needs to be awarded to it in the FOP configuration file (fop.xconf):
<image-loading>
<penalty value="-10000" class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawPNG" />
<penalty value="INFINITE" class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderPNG" />
<penalty value="INFINITE" class="org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO" />
</image-loading>
<renderers>
<renderer mime="application/pdf">
<filterList>
<value>flate</value>
</filterList>
<xmlHandler mime="text/svg+xml"/>
</renderer>
<renderer mime="application/postscript">
<xmlHandler mime="text/svg+xml"/>
</renderer>
</renderers>Note that in the above example the ImageLoaderPNG and the ImageLoaderImageIO image loaders were disabled. The penalty of -10000 (reverse penalty) compensates the default penalty of 1000, and makes the ImageLoaderRawPNG image loader the preferred one.
The ImageLoaderPNG image loader is similar to the ImageLoaderImageIO one, in the sense that it also decodes the IDAT chunk, but it does so using the org.apache.xmlgraphics.image.codec.png.PNGImageDecoder class instead of com.sun.imageio.plugins.png.PNGImageReader class.