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 Chris Miles <ch...@chrismiles.org> on 2011/11/18 00:14:55 UTC

Image rendering problem from SVG

Good Evening,

 

I have an SVG which I have created (attached) which looks fine if I open it,
but when I render it to JPG or PNG the quality looks pretty awful and the
layers seems to be messed up. 

 

        PNGTranscoder t = new PNGTranscoder();

        t.addTranscodingHint(PNGTranscoder.KEY_WIDTH, this.imageWidth);


        t.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, new Float(height));

        TranscoderInput input = new TranscoderInput(doc);

        TranscoderOutput output = new TranscoderOutput(ostream);

        t.transcode(input, output);

 

or

 

        JPEGTranscoder t = new JPEGTranscoder();

        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));

        t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, this.imageWidth);

        t.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new Float(height));

        TranscoderInput input = new TranscoderInput(doc);

        TranscoderOutput output = new TranscoderOutput(ostream);

        t.transcode(input, output);

       

I then pass the output to the browser as image data. I have attached the
poor quality image result.

 

I hope someone can shed some light on this. Many Thanks..

 

Chris