xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandre Djioev <al...@socialchange.net.au>
Subject Re: SVG to PNG
Date Fri, 27 Jul 2001 04:46:59 GMT

Thierry,

I tryed to do what you said, but all the time I get an exeption:
 Exception 400 incompatible with
org.apache.batik.transcoder.keys.LengthKey@ffb38

I just add thouse two strings:


              pngTranscoder.addTranscodingHint(PNGTranscoder.KEY_WIDTH,
new Integer(width));
              pngTranscoder.addTranscodingHint(PNGTranscoder.KEY_HEIGHT,
new Integer(height));

What am I doing wrong?




On Thu, 26 Jul 2001, Thierry Kormann wrote:

> On Thursday 26 July 2001 10:19, Alexandre Djioev wrote:
> > Hello All,
> >
> > A have a chunk of code which converts SVG to PNG:
> >   PNGTranscoder pngTranscoder = new PNGTranscoder();
> >
> > pngTranscoder.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_CLASSNAME,
> >
> > "org.apache.xerces.parsers.SAXParser");
> >
> >
> > 		TranscoderInput svgInput = new TranscoderInput(new
> > ByteArrayInputStream(value));
> >
> > 		ByteArrayOutputStream outStream = new
> > ByteArrayOutputStream();
> >                 TranscoderOutput imageOutput = new
> > TranscoderOutput(outStream);
> >
> > 	try {
> >          	pngTranscoder.transcode(svgInput, imageOutput);
> > 	   } catch (Exception e) {System.out.println ("can't transform SVG
> > to PNG."); };
> >
> >
> >
> > It works and looks good for me, but I also want to define somewhere the
> > size of the output PNG image (width/height). Is it possible somehow to
> > implement?
>
> You can use the TranscodingHints: WIDTH and HEIGHT that let you define the
> size of the image. In addition to that, the TranscodingHint AOI let you
> define an area of interest inside the image (it's the area that will be
> rasterized).
>
> Finally, you can have a look at the Transcoder tutorial.
> http://xml.apache.org/batik/rasterizerTutorial.html
>
> Thierry.
>

-- 
best regards,
	Alexandre Djioev


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message