我使用仿射变换来完成此任务,这是我的代码,希望对您有所帮助
public static BufferedImage scale(BufferedImage sbi, int imageType, int dWidth, int dHeight, double fWidth, double fHeight) { BufferedImage dbi = null; if(sbi != null) { dbi = new BufferedImage(dWidth, dHeight, imageType); Graphics2D g = dbi.createGraphics(); AffineTransform at = AffineTransform.getScaleInstance(fWidth, fHeight); g.drawRenderedImage(sbi, at); } return dbi;}


