Here you can find the source of findNewHeight(BufferedImage origImage, double newWidth)
private static int findNewHeight(BufferedImage origImage, double newWidth)
//package com.java2s; /*//from www. jav a 2s .c o m * Copyright 2000-2013 Enonic AS * http://www.enonic.com/license */ import java.awt.image.BufferedImage; public class Main { private static int findNewHeight(BufferedImage origImage, double newWidth) { final double ratio = (double) newWidth / (double) origImage.getWidth(); return (int) Math.max(1.0, Math.round(ratio * origImage.getHeight())); } }