title: Conversion in Java from PNG to JPG changes white color into red
body: <p>While converting image using </p>
  
  <pre><code>UploadedFile uf; //as a paremeter in function; PrimeFaces Object;
  BufferedImage old = ImageIO.read(uf.getInputstream());
  ByteArrayOutputStream temp = new ByteArrayOutputStream();
  ImageIO.write(old, "jpg", temp);
  </code></pre>
  
  <p>white colors are changed into red..</p>
  
  <p><a href="http://www.primefaces.org/showcase/ui/file/upload/basic.xhtml" rel="noreferrer">http://www.primefaces.org/showcase/ui/file/upload/basic.xhtml</a></p>
  
  <p>Here's the effect:</p>
  
  <p><a href="https://i.stack.imgur.com/LozVg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LozVg.png" alt="before"></a><a href="https://i.stack.imgur.com/FiFZh.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/FiFZh.jpg" alt="after"></a></p>
  
  <p>Do you know how to handle this problem?
  Thanks for your help in advance :)</p>