You are always using the same scaling factor for the x- and the y-direction.
Although you could fix this by specifying two scaling factors like this
double scaleX = (double) width / srcWidth;
double scaleY = (double) height / srcHeight;
AffineTransform at = new AffineTransform();
at.scale(scaleX, scaleY);
I wonder why you are doing is this way. Just creating a scaled version of an image is usually rather easy...:
private static BufferedImage scaleImageTo(
BufferedImage image, int width, int height)
{
BufferedImage scaledImage =
new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = scaledImage.createGraphics();
g.setRenderingHint(
RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.drawImage(image, 0, 0, width, height, null);
g.dispose();
return scaledImage;
}