【问题标题】:Creating custom tags and editing IPTC metadata using Commons imaging or Sanselan android使用 Commons 成像或 Sanselan android 创建自定义标签和编辑 IPTC 元数据
【发布时间】:2017-09-21 11:56:44
【问题描述】:

我有一张图片,我必须添加 IPTC 元数据,如城市、州描述并将它们发送到服务器。

我到处搜索,发现很多库,如 IIMJ4SanselanCommons Imaging,但没有工作示例。 而且文档还不够完善。

谁能给我一个例子如何做到这一点?

【问题讨论】:

    标签: android metadata apache-commons iptc


    【解决方案1】:

    你可以使用我几年前从零开始创建的ICAFE。要实现您的目标,很简单:

    FileInputStream fin = new FileInputStream("input.jpg");
    FileOutputSteam fout = new FileOutputStream("output.jpg");
    
    Metadata.insertIPTC(fin, fout, createIPTCDataSet(), true);
    fin.close();
    fout.close();
    
    private static List<IPTCDataSet> createIPTCDataSet() {
            List<IPTCDataSet> iptcs = new ArrayList<IPTCDataSet>();
            iptcs.add(new IPTCDataSet(IPTCApplicationTag.CITY, "My City"));
            iptcs.add(new IPTCDataSet(IPTCApplicationTag.PROVINCE_STATE, "My State"));
            iptcs.add(new IPTCDataSet(IPTCApplicationTag.DOCUMENT_NOTES, "This is a test document to insert IPTC into image"));
    
            return iptcs;
    }
    

    【讨论】:

    • 谢谢,但我已经通过将值放在 EXIF INTERFACE 用户评论部分中来解决这个问题。下次我遇到这样的事情时,我会试试你的代码
    猜你喜欢
    • 2014-06-10
    • 2013-01-31
    • 2013-07-09
    • 1970-01-01
    • 1970-01-01
    • 2019-05-13
    • 2017-03-08
    • 1970-01-01
    • 2016-01-28
    相关资源
    最近更新 更多