HI,
I am testing  JPEGTranscoder to convert SVG file to JPEG file.
I found the sample code at apache batik homepage, and tested it. But it
causes error.
The error is occurred "t.transcode(input, output);"  and  the message is "
org.apache.batik.transcoder.TranscoderException: null".
I think that the code is not reading correct file from folder or writing
file to folder.

These are the  code I wrote. Please give me an advice.

Regards,


==============================================================================
JPEGTranscoder t = new JPEGTranscoder();

        // Set the transcoding hints.
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
                             new Float(.8));

        // Create the transcoder input.
        String svgURI = new File("C:/tmp/svgtest.svg").toString();
        TranscoderInput input = new TranscoderInput(svgURI);

        // Create the transcoder output.
        OutputStream ostream = new FileOutputStream("C:/tmp/out.jpg");
        TranscoderOutput output = new TranscoderOutput(ostream);

        try{
            // Save the image.
            t.transcode(input, output);     <<<<<<<<====================
null exception
        }catch (TranscoderException ex) {
            ex.printStackTrace();
        }

        // Flush and close the stream.
        ostream.flush();
        ostream.close();
        System.exit(0);
======================================================================================
-- 
Saehoon Cheon
The University of Arizona
Dept.Electrical and Computer Engineering

Reply via email to