private synchronized static void disposeImage(BufferedImage src,  
            String outImgPath, int new_w, int new_h) {  
        // 得到图片  
        int old_w = src.getWidth();  
        // 得到源图宽  
        int old_h = src.getHeight();  
        // 得到源图长  
        BufferedImage newImg = null;  
        // 判断输入图片的类型  
        switch (src.getType()) {  
        case 13:  
            // png,gifnewImg = new BufferedImage(new_w, new_h,  
            // BufferedImage.TYPE_4BYTE_ABGR);  
            break;  
        default:  
            newImg = new BufferedImage(new_w, new_h, BufferedImage.TYPE_INT_RGB);  
            break;  
        }  
        Graphics2D g = newImg.createGraphics();  
        // 从原图上取颜色绘制新图 
        //g.setPaint(Color.WHITE);
        //g.fillRect(0,0,new_w,new_h); 
        g.drawImage(src, 0, 0, old_w, old_h, null);
        g.dispose();  
        // 根据图片尺寸压缩比得到新图的尺寸  
        newImg.getGraphics().drawImage(  
                src.getScaledInstance(new_w, new_h, Image.SCALE_SMOOTH), 0, 0,  
                null);  
        // 调用方法输出图片文件  
        OutImage(outImgPath, newImg);  
    }