code: public static BufferedImage resize(BufferedImage image, int width, int height)
      {
          final int transparency = image.getColorModel().getTransparency();
          final BufferedImage resized = createImage(width, height, transparency);
          final Graphics2D g = resized.createGraphics();
  
          optimizeGraphicsSpeed(g);
          g.drawImage(image, 0, 0, width, height, 0, 0, image.getWidth(), image.getHeight(), null);
          g.dispose();
  
          return resized;
      }
docs: Resize input image buffer.
  
  @param image The input image buffer.
  @param width The new width.
  @param height The new height.
  @return The new image buffer with new size.