title: How to improve the performance of g.drawImage() method for resizing images
body: <p>I have an application where users are able to upload pictures in albums but naturally the uploaded images need to be resized so there are also thumbs available and the shown pictures also fit in the page (eg. 800x600).
  The way I do the resize is like this:</p>
  
  <pre><code>Image scaledImage = img.getScaledInstance((int)width, (int)height, Image.SCALE_SMOOTH);
  BufferedImage imageBuff = new BufferedImage((int)width, (int)height, BufferedImage.TYPE_INT_RGB);
  Graphics g = imageBuff.createGraphics();
  g.drawImage(scaledImage, 0, 0, new Color(0,0,0), null);
  g.dispose();
  </code></pre>
  
  <p>And it works okayish. My only problem is that the <code>g.drawImage()</code> method seems to be awfully slow, and I just cannot imagine the user to be patient enought to wait for an upload of 20 pictures 20*10 secs ~ 3 minutes. In fact, on my computer it takes almost 40 secs for making the 3 different resizes for a single picture.</p>
  
  <p>That's not good enough, and I'm looking for a faster solution. I'm wondering if somebody could tell me about a better one in Java OR by calling a shell script, command, whatever hack you know, it has to be quicker, everything else does not matter this time.</p>