I am using the SVG generator to create a new SVG by drawing on a Graphics2D object. Once updates are complete, I need to rasterize this image to a PNG. When I do so, the PNGTranscoder (and JPEGTranscoder) continuously produce appropriately sized, but blank images (IE- a big image full of background color).
I have saved the SVG that I am attemting to rasterize, and Adobe's SVG viewer displays is properly. What might I be missing that could cause problems like this? Here is the code: DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation(); Document doc = domImpl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null); SVGGraphics2D svgGenerator = new SVGGraphics2D(doc); Element svgRoot = doc.getDocumentElement(); cr.drawScope(svgGenerator, 400, 400); svgGenerator.getRoot(svgRoot); svgRoot.setAttributeNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "width", "400"); svgRoot.setAttributeNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "height", "400"); // prepare the input and output for the transcoding process TranscoderInput ti = new TranscoderInput(doc); OutputStream outFile = new FileOutputStream("test/radar.png"); TranscoderOutput to = new TranscoderOutput(outFile); // prep the PNG transcoder for output Transcoder t = new PNGTranscoder(); t.addTranscodingHint(org.apache.batik.transcoder.image.ImageTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE); t.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, new Float(400)); t.addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, new Float(400)); Writer out = new FileWriter("test/radar.xml"); XMLSerializer xs = new XMLSerializer(out, new OutputFormat(doc)); xs.serialize(doc); // transcode t.transcode(ti, to); outFile.flush(); outFile.close(); -- Robert Gash, [EMAIL PROTECTED] (Web) http://gashalot.com/ (PGP) http://gashalot.com/pgpkeys.txt --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]