| 
					
				 | 
			
			
				@@ -117,23 +117,35 @@ public class ImageRotationCorrector { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static void main(String[] args) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            File fileDir = new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120460\\下"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            File fileDir = new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120450\\下"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             File[] files = fileDir.listFiles(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (File imageFile : files) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 String name = imageFile.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                System.out.println(name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //                File imageFile = file; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 BufferedImage image = ImageIO.read(imageFile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 // 获取EXIF方向信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int orientation = getImageOrientation(imageFile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (1 != orientation) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    double dushu = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (orientation == 6) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dushu = 270; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else if (orientation == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dushu = 180; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else if (orientation == 8) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dushu = 90; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    System.out.println(orientation); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 校正图像方向 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     BufferedImage correctedImage = correctImageOrientation(image, orientation); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 旋转270度(逆时针90度) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BufferedImage rotatedImage = rotateImage(correctedImage, 270); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    ImageIO.write(rotatedImage, "jpg", new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120460\\上\\" + name)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BufferedImage rotatedImage = rotateImage(correctedImage, dushu); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ImageIO.write(rotatedImage, "jpg", new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120450\\上\\" + name)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    ImageIO.write(image, "jpg", new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120460\\上\\" + name)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ImageIO.write(image, "jpg", new File("D:\\onemapfile\\gdbh\\flight\\batch\\24001120450\\上\\" + name)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             System.out.println("图像方向已校正并保存"); 
			 |