Skip to content

The IT Blog

Data, Programming, IT

  • Home
  • Other Profiles
    • Google+
    • GitHub
    • Xing
  • Contact
  • Privacy Policy / Datenschutz
  • Xing
  • GitHub
  • Twitter
  • LinkedIn

Recent Posts

  • Google Maps SDK does not show map in Release Build (works in Emulator)
  • Space effective backups of Raspberry Pi SD-cards
  • How to install TvHeadend on a Raspberry Pi
  • Let’s Encrypt with Tomcat 7
  • How to run Tomcat on Port 80

Categories

  • Android
  • Java
  • Miscellaneous
  • NetBeans
  • Performance
  • Raspberry Pi
  • Scala
  • Swing

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
Privacy Policy / Datenschutz Proudly powered by WordPress