apache > cocoon
 

SVG/TIFF Serializer

SVG/TIFF Serializer

The SVG/TIFF serializes an xml svg document to a tiff image. The serialization uses the Batik's TIFFTranscoder internally.

  • Name : svg2tiff
  • Class: org.apache.cocoon.serialization.SVGSerializer
  • Cacheable: yes

Sitemap Configuration

A minimal sitemap configuration snippet declaring the svg2tiff serializer:

<map:serializers..
  <map:serializer name="svg2tiff"
    src="org.apache.cocoon.serialization.SVGSerializer"
    mime-type="image/tiff"
    logger="sitemap.serializer.svg2tiff"
  >
  </map:serializer>

A sitemap pipeline snippet using the svg2tiff serializer:

<map:match pattern="svg/*.tiff">
  <map:generate src="docs/samples/svg/{1}.svg"/>
  <map:serialize type="svg2tiff"/>
</map:match>

In the declaration section of the svg2tiff a number of parameters can be specified. The following snippet set the background color explicitly:

<map:serializers..
  <map:serializer name="svg2tiff"
    src="org.apache.cocoon.serialization.SVGSerializer"
    mime-type="image/tiff"
    logger="sitemap.serializer.svg2tiff"
  >
    <parameter name="background_color" type="color" value="#ff00ff"/>
  </map:serializer>

TIFFTranscoder Parameters

General ImageTranscoder parameters are described at the SVG Serializer user documentation.

The following section presents TIFFTranscoder specific parameters configurable for the TIFFTranscoder.

Parameter

Type

Comment

force_transparent_white

boolean

It controls whether the encoder should force the image's fully transparent pixels to be fully transparent white instead of fully transparent black. This is usefull when the encoded TIFF is displayed in a viewer which does not support TIFF transparency and lets the image display with a white background instead of a black background. However, note that the modified image will display differently over a white background in a viewer that supports transparency.

Further Reading

Further details about TIFFTranscoder, ImageTranscoder is available at Batik.