public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) {

    int width = originalImage.getWidth();

    int height = originalImage.getHeight();

    int heightPercent = (heightOut * 100) / height;

    int newWidth = (width * heightPercent) / 100;

    BufferedImage resizedImage =
        new BufferedImage(newWidth, heightOut, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = resizedImage.createGraphics();
    g.drawImage(originalImage, 0, 0, newWidth, heightOut, null);
    g.dispose();

    return resizedImage;
  }
public static BufferedImage resizeToHeight ( BufferedImage originalImage , int heightOut ) { int width = originalImage . getWidth ( ) ; int height = originalImage . getHeight ( ) ; int heightPercent = ( heightOut * 100 ) / height ; int newWidth = ( width * heightPercent ) / 100 ; BufferedImage resizedImage = new BufferedImage ( newWidth , heightOut , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D g = resizedImage . createGraphics ( ) ; g . drawImage ( originalImage , 0 , 0 , newWidth , heightOut , null ) ; g . dispose ( ) ; return resizedImage ; }
Resizes an image to the specified height, changing width in the same proportion
@param originalImage Image in memory
@param heightOut The height to resize
@return New Image in memory