获取图片信息

File file= new File(filename);
Metadata metadata = JpegMetadataReader.readMetadata(file);

Iterator  it = metadata.getDirectories().iterator();
while(it.hasNext()){
    Directory exif = it.next();
    Iterator tags = exif.getTags().iterator();
    while(tags.hasNext()){
        Tag tag = tags.next();
        System.out.println(tag.getDirectoryName()+"---"+tag.getTagName()+"  :"+tag);
    }
}

 

参考:https://github.com/drewnoakes/metadata-extractor/wiki/Getting-Started-(Java)#query-a-decoded-description-of-a-specific-tag

你可能感兴趣的:(获取图片信息)