if (width > getWidth()) {
throw new IllegalArgumentException("Width "+ width +" exceeds width of image, which is "+ getWidth());
}
int nHeight = width * img.getHeight() / img.getWidth();
MultiStepRescaleOp rescale = new MultiStepRescaleOp(width, nHeight);
rescale.setUnsharpenMask(AdvancedResizeOp.UnsharpenMask.Soft);
BufferedImage resizedImage = rescale.filter(img, null);
return new Image(resizedImage, sourceType);
}