xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thierry Kormann <tkorm...@ilog.fr>
Subject Re: SVG to PNG
Date Thu, 26 Jul 2001 09:00:19 GMT
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.


---------------------------------------------------------------------
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