title: Does ImageIO.read() take EXIF orientation metadata into account?
body: <p>In JPEG images, EXIF metadata is sometimes included and tells in what orientation the image should be shown.</p>
  
  <p>The question is, whether Java's <code>ImageIO.read()</code> takes EXIF into account while reading a JPEG image, and automatically applies the transformation.</p>
  
  <p>More concretely, if I use Java's <code>ImageIO</code> for converting a JPEG image with EXIF into a PNG image, is the orientation of the PNG image going to be correct? Or is the below code going to produce a PNG image without taking EXIF orientation instructions into account?</p>
  
  <pre><code>private byte[] convertToPng(byte[] imageFileAsByteArray) {
      ByteArrayInputStream bis = new ByteArrayInputStream(imageFileAsByteArray);
      BufferedImage bi = ImageIO.read(bis);
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ImageIO.write(bi, "png", bos);
  
      return bos.toByteArray();
  }
  </code></pre>