|
Hello
Im trying to load a SVG file into a Java Image
object with Batik ImageTranscoder but i cant figure out a clean and good
solution.
Neither have i found anything good poking around
in google results.
So maybe anyone has a idea or even some working
code how to do this.
At the moment im trying to load a SVG file using
PNGTranscoder and then transcoding it to TranscoderOutput,
making it a byteArray and creating a image with
it.
Transcoder t = new
PNGTranscoder();
TranscoderInput input = new TranscoderInput(
url.toString() );
ByteArrayOutputStream ostream =
null;
ostream = new
ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput( ostream ); t.transcode( input, output
);
ostream.flush(); ostream.close(); byte[] imgData =
ostream.toByteArray();
Image img = Toolkit.getDefaultToolkit().createImage( imgData ); Now using this code for loading 100 images, it is
very slow and takes up a lot of resources.
Over 60% of the CPU power is used for the
transcode() method, 40% of which goes to ImageTranscoder.transcode()
and
20% SAX parsing.
This seems to be a tad bit too much.
Any advice or other solutions?
Tanel Suurhans
|
- Re: Java/Batik Transcoding problem Tanel Suurhans
- Re: Java/Batik Transcoding problem Thomas DeWeese
