title: Portrait image resizing in java with imgscalr, but the final output is landscape. How to guarantee it stays the same orientation?
body: <p>I am using imgscalr to create scale my images in a Grails application.   Here is the code:</p>
  
  <pre><code>BufferedImage sourceImg = ImageIO.read(new File("/tmp" + File.separator + filename))
  BufferedImage destImg = null
  
  if(sourceImg.height &gt;= sourceImg.width){
      destImg = Scalr.resize(sourceImg, Scalr.Method.AUTOMATIC, Scalr.Mode.FIT_TO_HEIGHT, 800) 
  }
  else{
      destImg = Scalr.resize(sourceImg, Scalr.Method.AUTOMATIC, Scalr.Mode.FIT_TO_WIDTH, 800)
  }
  
  File newFile = new File("/tmp/processed" + File.separator + filename)
  String formatName = foto.nomeArquivo.substring(foto.nomeArquivo.lastIndexOf('.')+1);
  ImageIO.write(imgDestino, formatName.toUpperCase(), newFile)
  </code></pre>
  
  <p>Please do not mind about formatName so far.... I am still testing the imgscalr library.</p>
  
  <p>All my images end in landscape orientation. I am developing in a Mac OS.</p>
  
  <p>Thanks</p>