apache > cocoon
 
Font size:      

SVG/JPEG Serializer (2.1 legacy document)

Warning
This document was copied as is from the Cocoon 2.1 documentation, but has not yet been fully reviewed or moved to its new home.

SVG/JPEG Serializer

The SVG/JPEG serializes an xml svg document to a jpeg image. The serialization uses the Batik's JPEGTranscoder internally.

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

Sitemap Configuration

A minimal sitemap configuration snippet declaring the svg2jpeg serializer:

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

A sitemap pipeline snippet using the svg2jpeg serializer:

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

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

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

JPEGTranscoder Parameters

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

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

ParameterTypeComment
qualityfloatSpecifies the JPEG quality as value between 0.0 and 1.0, 1.0 specifies highest quality. Usually a value of 0.9 is choosen.

Further Reading

Further details about JPEGTranscoder, ImageTranscoder is available at Batik.

Comments

add your comments