Hi,

 

I have a SVG file that I am rasterizing to a JPG file by using the “Rasterizing” app at a higher resolution of 150 dpi.

 

Java –jar batik-rasterizer.jar –q 0.99 –dpi 150 xyz.svg

 

HOWEVER, when I try to achieve the same effect using Transcoding hints in my program the resolution hint does not take affect and the JPEG image turns out to have a lower resolution. Here is the code…..

 

JPEGTranscoder t = new JPEGTranscoder ();

// set the transcoding hints

 

t.addTranscodingHint (JPEGTranscoder.KEY_MEDIA, "image/jpeg");

t.addTranscodingHint (JPEGTranscoder.KEY_QUALITY, new Float (0.99f));

t.addTranscodingHint (JPEGTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER, new Float (0.1693f));

 

String svgURI = new File (“xyz.svg”).toURL().toString();

TranscoderInput input = new TranscoderInput (svgURI);

 

OutputStream ostream = new FileOutputStream (“xyz.jpg”);

TranscoderOutput output = new TranscoderOutput (ostream);

 

// save the image

t.transcode (input, output);

 

// flush and close the stream then exit

ostream.flush ();

ostream.close ();

 

 

Any help will be much appreciated!!

 

Thanks,

 

Ashish Kheterpal

 

Reply via email to