java 缩放图片
BufferedImage bufTarget = null;
GetImage(srcPath,width,height);
double sx = (double) width / bufImage.getWidth();
double sy = (double) height / bufImage.getHeight();
int type = bufImage.getType();
if(type == BufferedImage.TYPE_CUSTOM){
ColorModel cm = bufImage.getColorModel();
WritableRaster raster = cm.createCompatibleWritableRaster(width,
height);
boolean alphaPremultiplied = cm.isAlphaPremultiplied();
bufTarget = new BufferedImage(cm, raster, alphaPremultiplied, null);
}else
bufTarget = new BufferedImage(width, height, type);
Graphics2D g = bufTarget.createGraphics();
g.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g.drawRenderedImage(bufImage, AffineTransform.getScaleInstance(sx, sy));
g.dispose();
return bufTarget;