public void cutImg() throws Exception{
		String dirName="testimg";
		//获取目录下所有的文件
		File[] files = new File(dirName).listFiles();
//		File file = files[0];
		int i=0;
		for(File file :files){
			BufferedImage bi = ImageIO.read(file);
	//		buffImage = buffImage.getSubimage(1, 1, buffImage.getWidth()-2, buffImage.getHeight()-2);
		
			int h=bi.getHeight();//获取图像的高  
	        int w=bi.getWidth();//获取图像的宽  

	        int srgb=bi.getRGB(0, 0);//获取指定坐标的ARGB的像素值  
	        int r,g,b;
	        BufferedImage nbi=new BufferedImage(w,h,BufferedImage.TYPE_BYTE_BINARY);  
	        for (int y = 0; y < h; y++) {  
	            for (int x = 0; x < w; x++) {  
	            	srgb = bi.getRGB(x, y);
		            nbi.setRGB(x, y, srgb);
	            }  
	        } 
	        ImageIO.write(nbi, "jpg", new File("okimg/jpg/"+i+".jpg"));  
	        
	        RenderedOp src = JAI.create("fileload","okimg/jpg/"+i+".jpg");
	        OutputStream os = new FileOutputStream("okimg/"+i+".tif");
	        TIFFEncodeParam param = new TIFFEncodeParam();
	        ImageEncoder enc = ImageCodec.createImageEncoder("TIFF", os,param);
	        enc.encode(src);
	        os.close();//关闭流
	        i++;
		}
	}