title: Transcode SVG to JPEG
body: <p><a href="https://i.stack.imgur.com/u3MCv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u3MCv.png" alt="the original image was svg, but i can only upload png-format not svg-format" /></a></p>
  <p>my picture in SVG format include the latest data 122.6 but in JPEG format the last data point is 122.1</p>
  <p>How can I convert the image in svg-format to jpeg-format without the lost of the latest data
  renderer ?
  padding margins ?
  size ?</p>
  <p>What is wrong in my code ??</p>
  <p>best ghost</p>
  <pre><code>package helix;
  
  import java.io.*;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  
  import org.apache.batik.transcoder.image.JPEGTranscoder;
  import org.apache.fop.svg.PDFTranscoder;
  import org.apache.batik.transcoder.TranscoderInput;
  import org.apache.batik.transcoder.TranscoderOutput;
  import org.apache.batik.ext.awt.image.codec.*;
  
  
  public class genesisMATPIsvg2jpg {
      
      
      
      public static void main(String[] args) throws Exception {
          
                  
          //Step -1: We read the input SVG document into Transcoder Input
          String svg_URI_input = new File(basePath + &quot;/var/gWebClient/Materialkostenindex2015=100.svg&quot;).toURL().toString();
          TranscoderInput input_svg_image = new TranscoderInput(svg_URI_input);        
          //Step-2: Define OutputStream to JPG file and attach to TranscoderOutput
          OutputStream jpg_ostream = new FileOutputStream(basePath + &quot;/var/gWebClient/Materialkostenindex2015=100.jpeg&quot;);
          TranscoderOutput output_jpg_image = new TranscoderOutput(jpg_ostream);              
          // Step-3: Create JPEGTranscoder and define hints
          JPEGTranscoder my_converter = new JPEGTranscoder();
          
          Object jpegQuality1 = new Float(800);
          Object jpegQuality2 = new Float(600);
          
          my_converter.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, jpegQuality1);
          my_converter.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, jpegQuality2);
          
          my_converter.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(0.9));
          // Step-4: Write output
          my_converter.transcode(input_svg_image, output_jpg_image);
          // Step 5- close / flush Output Stream
          jpg_ostream.flush();
          jpg_ostream.close();        
      }
  }
  </code></pre>