This tool let you transform SVG images into pure Java2D code with no external dependencies. The following features are supported:
These SVG features are not supported:
The SVG transcoder successfully converted more than 5000 icons from various GNOME and KDE themes. On average
.class file with gzip compression is about 30% bigger than the corresponding
svgz image. With pack200+gzip compression it's about 40% smaller.
The transcoder is available as a simple graphical interface, just drop your SVG images on the window and a Java source file will be generated in the directory of the original image.
You can also transform several SVG images with an Ant task. The syntax is similar to the
<taskdef name="svg2java" classname="org.pushingpixels.flamingo.api.svg.SvgTranscoderTask" classpath="flamingo-svg-transcoder-ant-1.2.jar"/> <svg2java todir="build/icons" verbose="true" namingStrategy="default" template="plain"> <fileset dir="src/main/resources/svg" includes="**/*.svg*"/> </svg2java>
|file||The SVG file to transform.||Yes, unless a nested resource collection element is used.|
|todir||The directory to transform to.||Yes|
The naming strategy used to generate the Java class names from the SVG file names:
||No; defaults to "default".|
The template used to generate the Java class:
||No; defaults to "plain".|
|overwrite||Overwrite existing files even if the destination files are newer.||No; defaults to false.|
|flatten||Ignore the directory structure of the source files, and transform all files into the directory
specified by the
||No; defaults to false.|
|verbose||Log the files that are being transformed.||No; defaults to false.|
The Ant task is available for download here.
BSD, Apache License 2.0
The SVG Transcoder has been originaly developped by Kirill Grouchnikov as part of the Flamingo project (see his blog for more information). It leverages the Apache Batik project for parsing the SVG files.
You can also clone the project with Git by running:
$ git clone git://github.com/ebourg/flamingo-svg-transcoder