Hello, I am a newbie, trying out Batik to learn how it works. I am running it on Redhat 8.0.
When trying to create jpegs from svg files, the rasterizer creates only blank or empty files. This is true from the command line utility or the included java example app. However, the command line utility works correctly when creating png files. command line example: java -jar batik-rasterizer.jar -d /home/paul/ -m image/jpeg samples/anne.svg (substituting image/png produces a viewable .png file) the sample code comes from: http://xml.apache.org/batik/rasterizerTutorial.html SaveAsJPEGTiles.java ==================== import java.io.*; import java.awt.*; import org.apache.batik.transcoder.image.JPEGTranscoder; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; public class SaveAsJPEGTiles { JPEGTranscoder trans = new JPEGTranscoder(); public SaveAsJPEGTiles() { trans.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8)); } public void tile(String inputFilename, String outputFilename, Rectangle aoi) throws Exception { trans.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new Float(aoi.width)); trans.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new Float(aoi.height)); trans.addTranscodingHint(JPEGTranscoder.KEY_AOI, aoi); String svgURI = new File(inputFilename).toURL().toString(); TranscoderInput input = new TranscoderInput(svgURI); OutputStream ostream = new FileOutputStream(outputFilename); TranscoderOutput output = new TranscoderOutput(ostream); trans.transcode(input, output); ostream.flush(); ostream.close(); } public static void main(String [] args) throws Exception { SaveAsJPEGTiles p = new SaveAsJPEGTiles(); String in = "samples/anne.svg"; int documentWidth = 450; int documentHeight = 500; int dw2 = documentWidth / 2; int dh2 = documentHeight / 2; p.tile(in, "tileTopLeft.jpg", new Rectangle(0, 0, dw2, dh2)); p.tile(in, "tileTopRight.jpg", new Rectangle(dw2, 0, dw2, dh2)); p.tile(in, "tileBottomLeft.jpg", new Rectangle(0, dh2, dw2, dh2)); p.tile(in, "tileBottomRight.jpg", new Rectangle(dw2, dh2, dw2, dh2)); System.exit(0); } } Thanks, Paul Warner --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
