版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_24606505/article/details/71107090
//导入jar包后执行如下代码即可在控制台输出信息
public class Main {
/**
* @param args
*/
public static void main(String[] args) throws ImageProcessingException,
IOException, MetadataException {
File jpegFile = new File("D:\\exiftemp (2).JPG");
Metadata metadata;
try {
metadata = JpegMetadataReader.readMetadata(jpegFile);
Iterator<Directory> it = metadata.getDirectories().iterator();
while (it.hasNext()) {
Directory exif = it.next();
Iterator<Tag> tags = exif.getTags().iterator();
while (tags.hasNext()) {
Tag tag = (Tag) tags.next();
System.out.println(tag);
}
}
} catch (JpegProcessingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}