2015-01-31 41 views

回答

0

有一類RotatedIcon(參見鏈接),可以像這樣

 if (imageOrientation.equals("3")) { 
      rotatedIcon = new RotatedIcon(imageIcon, RotatedIcon.Rotate.UPSIDE_DOWN); 
     } else if (imageOrientation.equals("6")) { 
      rotatedIcon = new RotatedIcon(imageIcon, RotatedIcon.Rotate.DOWN); 
     } else if (imageOrientation.equals("8")) { 
      rotatedIcon = new RotatedIcon(imageIcon, RotatedIcon.Rotate.UP); 
     } 

imageOrientation使用是圖像元數據的屬性(例如,EXIF)

https://tips4java.wordpress.com/2009/04/06/rotated-icon/

https://github.com/griffon/griffon-javatips-plugin/blob/master/src/main/com/wordpress/tipsforjava/swing/RotatedIcon.java

+0

你好, 謝謝你的答案,但我想要的是旋轉圖像無損,保留EXIF數據在圖片。 至少有兩個圖書館,可能會有訣竅:LLJTran和Commons Imaging(來自Sanselan)。 LLJTran不支持一些現代EXIF字段,因此我想用Apache Commons Imaging旋轉JPEG,但無法找到它的代碼示例。 – 2015-02-16 08:14:58