首页>代码>java获取图片的metadata的方法>/metadata-extractor/src/com/javaniu/test/Main.java
01package com.javaniu.test;
02 
03import java.io.File;
04 
05import com.drew.imaging.jpeg.JpegMetadataReader;
06import com.drew.metadata.Directory;
07import com.drew.metadata.Metadata;
08import com.drew.metadata.Tag;
09 
10public class Main {
11 
12    public static void main(String[] args) {
13        String root = Main.class.getResource("/").getFile();
14        File withExif = new File(root + "withExifAndIptc.jpg");
15        try {
16            Metadata metadata = JpegMetadataReader.readMetadata(withExif);
17            for (Directory directory : metadata.getDirectories()) {
18                for (Tag tag : directory.getTags()) {
19                    System.out.println(tag);
20                }
21            }
22        } catch (Exception e) {
23            e.printStackTrace();
24        }
25    }
26}
最近下载更多
yhxmbb1026  LV1 2021年3月5日
mayunli288  LV1 2021年2月16日
chensi_  LV1 2020年8月13日
wlax99  LV12 2019年12月3日
稀饭囡  LV9 2017年11月29日
zhanghuaizhu  LV2 2017年6月6日
821497507  LV12 2017年5月20日
win10skiller  LV2 2017年4月15日
secretmx  LV2 2017年2月24日
new_obj  LV3 2017年1月18日
最近浏览更多
heqian  LV17 2023年1月10日
微信网友_5857910989295616  LV1 2022年3月4日
2294878733  LV1 2021年10月20日
而我认为  LV6 2021年9月26日
mayunli288  LV1 2021年2月16日
dongzhan  LV12 2020年12月8日
chensi_  LV1 2020年8月13日
caozhaoqi83  LV5 2020年6月8日
Jokerbean  LV1 2020年5月5日
liangju666  LV6 2020年3月3日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友