I am using Batik to handle SVG images. Is there any way to get a java.awt.image.BufferedImage from a SVG-file?
I know there are transcoders, with which I could trans
A very easy way is to use the TwelveMonkeys lib which adds additional image type support to java's ImageIO
So for example you just add these to your maven (or copy the needed jars):
com.twelvemonkeys.imageio
imageio-batik
3.2.1
batik
batik-transcoder
1.6-1
And then you just read it with
BufferedImage image = ImageIO.read(svg-file);
To check if the svg reader is registered correctly you could print out the image readers:
Iterator readers = ImageIO.getImageReadersByFormatName("SVG");
while (readers.hasNext()) {
System.out.println("reader: " + readers.next());
}
The lib also supports additional params, see readme on github.