title: How convert SVG to JPEG in java
body: <p>I have a <strong>MulipartFile</strong> object which caries an SVG image. I want to convert that into <strong>JPEG format</strong>. How can I achieve this ? I tried the following, But getting an Enclosed Exception as the system cannot find the file specified.</p>
  
  <pre><code>        JPEGTranscoder t = new JPEGTranscoder();
  
          File f = new File("temp.svg");
          multipartfile.transferTo(f);
          // Create a JPEG transcoder
  
          // Set the transcoding hints.
          t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
                     new Float(.8));
  
          // Create the transcoder input.
          String svgURI = f.toURL().toString();
          TranscoderInput input = new TranscoderInput(svgURI);
  
          // Create the transcoder output.
          OutputStream ostream = new FileOutputStream("out.jpg");
          TranscoderOutput output = new TranscoderOutput(ostream);
  
          // Save the image.
          t.transcode(input, output);
  
          // Flush and close the stream.
          ostream.flush();
          ostream.close();
  </code></pre>