public static void main (String argv[]) { try { File fi = new File("c:/image2.jpg"); //大图文件 File fo = new File("c:/imgTest.jpg"); //将要转换出的小图文件 int nw = 100; AffineTransform transform = new AffineTransform(); BufferedImage bis = ImageIO.read(fi); int w = bis.getWidth(); int h = bis.getHeight(); double scale = (double)w/h; int nh = (nw*h)/w ; double sx = (double)nw/w; double sy = (double)nh/h; transform.setToScale(sx,sy); System.out.PRintln(w + " " +h); AffineTransformOp ato = new AffineTransformOp(transform,null); BufferedImage bid = new BufferedImage(nw,nh,BufferedImage.TYPE_3BYTE_BGR); ato.filter(bis,bid); ImageIO.write(bid,"jpeg",fo); } catch(Exception e) { e.printStackTrace(); } }