Your title seems to mismatch your description (such as it is). If you are trying to read a JPEG so large that it won't fit in memory I think you are out of luck with Batik. However if the problem is that you are trying to write a JPEG too large for memory (which seems to match you saying svgCanvas.setSize(...) you might try using the TiledImageTranscoderfrom the contrib directory which will write a Tiled Tiff file rendering strips of the image rather than the entire image at once. I've used it in the past to print very large images from Batik.
BTW have you adjusted the default Java memory partition (-Xmx)? That might help you although 18K x 18K is more than 1GB of memory so you would likely need a 64bit version of Java so you can allocate more than 2GB of memory and performance is likely to suffer. -Thomas On Thu, Mar 7, 2013 at 11:06 AM, mihir <mihir_amr...@yahoo.com> wrote: > Hello All > > this is my first post to this forum. i have generated svg file, using > following code, > > > public class TestSVGGen { > > static BufferedImage img; > > public void paint(SVGGraphics2D g2d) { > g2d.setPaint(Color.red); > g2d.fill(new Rectangle(10, 10, 100, 100)); > g2d.drawImage(img, 0, 0, img.getWidth() ,img.getHeight(), > null); > g2d.setSVGCanvasSize(new Dimension(img.getWidth(), > img.getHeight())); > } > > public static void main(String[] args) throws IOException { > > img = > > ImageIO.read(TestSVGGen.class.getClassLoader().getResourceAsStream("images/test_offscreen.jpg")); > > // Get a DOMImplementation. > DOMImplementation domImpl = GenericDOMImplementation > .getDOMImplementation(); > > // Create an instance of org.w3c.dom.Document. > String svgNS = "http://www.w3.org/2000/svg"; > Document document = domImpl.createDocument(svgNS, "svg", > null); > > // Create an instance of the SVG Generator. > SVGGraphics2D svgGenerator = new SVGGraphics2D(document); > > > // Ask the test to render into the SVG Graphics2D > implementation. > TestSVGGen test = new TestSVGGen(); > test.paint(svgGenerator); > > // Finally, stream out SVG to the standard output using > // UTF-8 encoding. > boolean useCSS = true; // we want to use CSS style > attributes > File file = new File("image.svg"); > FileOutputStream fos = new FileOutputStream(file); > Writer out = new OutputStreamWriter(fos, "UTF-8"); > svgGenerator.stream(out, useCSS); > > > } > > now , i want to re size this image canvas to 18,000 * 18000 in dimensions > because i want to re size included image to this size , but whenever i try > the following code (only portion of the code) > > svgCanvas.setSize(new Dimension(18000, 18000)); > > the program throws out of memory exception, > > what should i do to re size to specified large size , is there any work > around like tiling or segmentation of image . > > i am very new to batik so please help me > > > > > > > -- > View this message in context: > http://batik.2283329.n4.nabble.com/OutofMemory-while-reading-JPEG-file-Using-Apache-Batik-tp4655495.html > Sent from the Batik - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org > For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org > >