A. java實現圖片旋轉90度的問題
翻轉來後源 orientation 屬性為6 。
public static void main(String[] args) throws ImageProcessingException, IOException {
File jpegFile= new File("C:\\Users\\Administrator\\Desktop\\IMG_0362.JPG");
Metadata metadata = ImageMetadataReader.readMetadata(jpegFile);
Directory directory = metadata.getDirectory(ExifIFD0Directory.class);
JpegDirectory jpegDirectory = (JpegDirectory)metadata.getDirectory(JpegDirectory.class);
// int orientation =0;
B. java翻轉字元串
importjava.util.Scanner;
publicclassTurnString{
publicstaticvoidmain(String[]args){
Scannersc=newScanner(System.in);
System.out.println("輸入字元版串");
Stringstr=sc.next();
System.out.println("翻轉前:權"+str);
Strings="";
for(inti=str.length()-1;i>=0;--i)
s+=str.charAt(i);
System.out.println("翻轉後:"+s);
}
}