xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amanda Fernandez Redondo" <jaip...@gmail.com>
Subject Transcoding images: they result cutted
Date Thu, 15 Nov 2007 08:45:21 GMT
Hi, I've been reading in the list, and I've found a user making this
question, but whitout answer:

I'm probably missing something really simple here. I'm using Batik 1.6
to generate svg output from a java application (using SVGGraphics2D) and

then using a transcoder to convert that output to an image format. The
problem I'm seeing is that the generated image is clipped/cut off on the
right hand side. The original application dimensions are 600x400 (width

x height) pixels, and the generated image is also that size, but nothing
seems to draw beyond the 400-pixel mark on the right side. I'd
appreciate any suggestions on how to resolve this.

Now I have the same problem, when I convert a svg file into JPEG or
PNG, it only transcode a piece of it, the left and superior corner.

This is the code:

 JPEGTranscoder t = new JPEGTranscoder();

            // Set the transcoding hints.
            t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(.5));

            // Create the transcoder input.
            TranscoderInput input = new TranscoderInput(
canvas.getSVGDocument());

            // Create the transcoder output.
            OutputStream ostream = new FileOutputStream(archivo.getPath
()+".jpg");
            TranscoderOutput output = new TranscoderOutput(ostream);

            Rectangle aoi = new Rectangle(0, 0, canvas.getWidth(),
canvas.getHeight());
            t.addTranscodingHint (JPEGTranscoder.KEY_WIDTH, new Float (
aoi.width));
            t.addTranscodingHint (JPEGTranscoder.KEY_HEIGHT, new Float (
aoi.height));

            // Save the image.
            t.transcode(input, output);

            // Flush and close the stream.
            ostream.flush();
            ostream.close();

Thanks

-- 
Amanda Fernández Redondo

Mime
View raw message