title: Change the format of an Image in java without saving
body: <p>I would like to read an image and then change its format but without saving it.</p>
  
  <p>For example I can read the image like this<br>
  <code>BufferedImage img=ImageIO.read(new File(fileName));</code><br><br></p>
  
  <p>Then I want to change the format of <code>img</code>, for example from jpeg to png.
  The only way I found is to use <code>ImageIO.read</code> to write and then read the new image, but it does seem to be an efficient way to do it.</p>