Not sure what I am doing wrong, but the image that is saved is the same as the original ~ 500px high. I am trying to set the image to 100px high and keep the aspectratio the same. Then save the smaller version.
BufferedImage original = ImageIO.read(inputStream);
Integer width = original.getWidth();
float aspectratio = (float)original.getWidth()/(float)original.getHeight();
Integer newwidth= Math.round(100*aspectratio);
BufferedImage scaledImage = new BufferedImage(newwidth,100,original.getType());
Graphics2D g = scaledImage.createGraphics();
g.drawImage(scaledImage,0,0,null);
g.dispose();
ImageIO.write(scaledImage, "PNG", result);