You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Amanda Fernandez Redondo <ja...@gmail.com> on 2007/11/15 09:45:21 UTC
Transcoding images: they result cutted
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
Re: Transcoding images: they result cutted
Posted by Joe <in...@objectleague.com>.
>I'm seeing is that the generated image is clipped/cut off on theright hand
side. >The original application dimensions are 600x400 (width
> x height) pixels, and the generated image is also that size, but nothingseems
to >draw beyond the 400-pixel mark on the right side.
Hi there,
I vaguely remember smth about a default destination dimension of 400x400
for ImageTranscoders.
Take a look and see where ImageTranscoder sets up the default Transcoding hints.
I am sure you will find some related constants.
Good luck,
Joe
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org