You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by Apache Wiki <wi...@apache.org> on 2012/06/15 16:09:56 UTC

[Xmlgraphics-fop Wiki] Update of "HowTo/ImageLoaderRawPNG" by LuisBernardo

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlgraphics-fop Wiki" for change notification.

The "HowTo/ImageLoaderRawPNG" page has been changed by LuisBernardo:
http://wiki.apache.org/xmlgraphics-fop/HowTo/ImageLoaderRawPNG

New page:
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 the image loader 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org