Skip to content

The IT Blog

IT, Tech, Data, …

  • Home
  • Blog
    Thoughts about IT, Data, Work Culture
  • HowTos
    Stuff that was hard to find but very helpfull.
  • Research
    Posts from my research activities during my University time
  • About
  • GitHub
  • RSS
  • Mastodon

IPTC-Tags mit Imagero schreiben

Mit folgendem Java Code kann man mit Imagero (Version 398) ein IPTC-Feld (hier: Keyword) schreiben. Ist der Keywords-Eintrag im Bild noch nicht vorhanden, wird er erstellt, andernfalls wird “foo” der Liste hinzugefügt.

public class TestImagero {
    public static void main(String[] args) throws Exception {
        LicenseManager.install(new FranzGraf());
        String src = "a.JPG";
        IOParameterBlock iopb = new IOParameterBlock(src);
        IOParameterBlock iopbDst = new IOParameterBlock(src).setDestination(src);
        IPTCEntryCollection iec = MetadataUtils.getIPTC(iopb);
        iec.addEntry(IPTCEntryMeta.KEYWORDS, "foo".getBytes());
        MetadataUtils.insertIPTC(iec, iopbDst);
        iopb.close();
        iopbDst.close();
    }
}

Einen Eintrag namens “foo_2” entfernt man aus den Keywords folgendermaßen:

            IOParameterBlock iopb = new IOParameterBlock(src);
            IOParameterBlock iopbDst = new IOParameterBlock(src).setDestination(src);
            IPTCEntryCollection iec = MetadataUtils.getIPTC(iopb);
            IPTCEntry[] entries = iec.getEntries(IPTCEntryMeta.KEYWORDS);
            List removes = new ArrayList();
            for (IPTCEntry entry : entries) {
                if (new String(entry.getData()).equals("foo_2")) {
                    removes.add(entry);
                }
            }
            for (IPTCEntry rem : removes) {
                System.out.println(iec.removeEntry(rem));
            }
            MetadataUtils.insertIPTC(iec, iopbDst);
            iopb.close();
            iopbDst.close();
Posted on 26. December 2010Author FranzCategories JavaTags Bild, Image, Imagero, Java, metadata

Post navigation

Previous Previous post: TeXnicCenter: PDF vor Compilierung schließen
Next Next post: Epson Perfection 1240U mit Windows7 64bit und Windows 10
Imprint Proudly powered by WordPress