title: Getting low quality thumbnail from a high quality image in Java
body: <p>I have tried the below code to generate the high quality thumbnail image but got the thumb nail blurred and not that much clarity.</p>
  
  <pre><code>BufferedImage thumbImage = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB);
  Graphics2D graphics2D = thumbImage.createGraphics();
  graphics2D.setBackground(Color.WHITE);
  graphics2D.setPaint(Color.WHITE); 
  graphics2D.fillRect(0, 0, thumbWidth, thumbHeight);
  graphics2D.setComposite(AlphaComposite.Src);
  graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
  graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
  graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);
  graphics2D.dispose();      
  File file = new File(thumbnailFile);
  if (javax.imageio.ImageIO.write(thumbImage, "JPG", file))
      return file;
  }
  </code></pre>
  
  <p>The original image is a high quality image. Why am I getting the thumbnail image distorted and low in quality?</p>