title: Resize an image without reading it again from disk?
body: <p>I need to resize an image based on it's longest side, e.g. longest side - which can be width or height - should be only 100 pixels long.</p>
  
  <p>Currently I am using this method:</p>
  
  <pre><code>private Image resizeImageByLongestSide(File imageFile, int lengthLongestSide)
  {
      String uri ="file:" + imageFile.getAbsolutePath();
      Image image = new Image(uri); // raed to determine width/height
  
      // read image again for resizing
      if(image.getWidth() &gt;= image.getHeight())
          return new Image(uri, lengthLongestSide, 0, true, false);
      else
          return new Image(uri, 0, lengthLongestSide, true, false);
  }
  </code></pre>
  
  <p>So, first the image has to be read by disk to figure out which side is the longest side, than it has again to be read from the disk, because resizing seems only possible by using the Image constructor... Any hint/improvement on this? Thanks :-)</p>