import iptc keywords

  • Jean Granié
    Jean Granié

    is there a way to get the iptc.application2.keywords usable in an import script ?
    I can see this info with exiv2 -P I filename but I didn't find a way to get it in my js code.

    • robolaf

      I'd like to do so as well... however I'm running MT on NSLU2.
      Any solution to this?

  • Werner

    I have been in contact with the libextractor maintainer (Christoph) and he added in the 5.23 codeline support for that. When you checkout his latest code, it includes many needed attributes like Iptc.keywords, xmp.ratings (shown in Windows as Rating of the image) and some more.
    Using libextractor in mediatomb then I failed miserably. Compiled with libextractor support, changed the config.xml to retrieve those tags had no effect, looking at the source code of MT seemed to reveal that only hard coded tags can be used. And when using those still nothing showed up. So it seems the entire libextractor I did not get working, not even the examples from the scripting Wiki. Turning on debugging did not help either to understand the root cause, it simply never jumped into the code.
    And then the login page of mediatomb kept showing up although no enabled and I was using the port MT was running under at that time and browser cache was emptied….so I gave up.

    What I do instead now is using libexif to get the keywords.
    I have one folder called original_images with their 4000px resolution out of the cam and each image gets transcoded to the 1920x1080 equivalent and during that process the tags libexif knows about are set, e.g. is put into the exif.usercomment tag.

  • Petr Cerny
    Petr Cerny

    Hello, I've been experimenting with libextractor too and I wonder whether anyone managed to create import script that could sort images by exif.image.rating?
    What I did so far:
    Mediatomb 0.12.1 is compiled on Gentoo x64 with libexif and libextractor support. LibExif is 0.6.20 and LibExtractor is 0.6.2.

    In config.xml I define these library options:

              <add-data tag="EXTRACTOR_DATE"/>
              <add-data tag="EXTRACTOR_TITLE"/>
              <add-data tag="EXTRACTOR_AUTHOR"/>
              <add-data tag="EXTRACTOR_DESCRIPTION"/>
              <add-data tag="EXTRACTOR_COMMENT"/>
              <add-data tag="EXTRACTOR_SUBJECT"/>
              <add-data tag="EXIF_TAG_DATE_TIME"/>
              <add-data tag="EXIF_TAG_DATE_TIME_ORIGINAL"/>
              <add-data tag="EXIF_TAG_DATE_TIME_DIGITIZED"/>

    In import.js I am curious about which properties are set so I tried using:

        for each(var item in obj.meta){
            chain = new Array('Fotky','META',item);
            addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER);
        for each(var item in obj.aux){
            chain = new Array('Fotky','AUX',item);
            addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER);

    Result is one record in META containing date in format YYYY-MM-DD and three records in AUX containing date and time in format YYYY:MM:DD HH:MM:SS.

    Nothing else.

    ~ $ extract IMGP0536.JPG
    Keywords for file IMGP0536.JPG:
    camera make - PENTAX            
    camera model - PENTAX K20D       
    orientation - left, bottom
    creation date - 2011:09:13 08:42:02
    exposure bias - 0 EV
    flash - No, compulsory
    focal length - 18.0 mm
    focal length 35mm - 27.0 mm
    iso speed - 800
    exposure mode - Not defined
    metering mode - Multi-segment
    aperture - F5.6
    exposure - 1/750 s
    image dimensions - 4672x3104
    keywords - Scotland
    country - Scotland
    mimetype - image/jpeg
    image dimensions - 4672x3104
    mimetype - image/jpeg

    What do I have to do to obtain all the info? exiv2 -P EIX shows all the necessary data including Exif.Image.Rating and Xmp.xmp.Rating are included in the photo.

  • Petr Cerny
    Petr Cerny

    Ok, problem solved. I recompiled MediaTomb with exiv2 support. I know it was dropped due to the memory leaks in exiv2 library, but it was many years ago and from my testing so far it seems to be highly usable and stable.
    Moreover it can easily extract any EXIF, XMP or IPTC data from the image.
    If anyone is interested in conforming that there are no memory leaks anymore I can upload the sources somewhere.

  • Luca Riva
    Luca Riva

    Hi, I red that you, Petr Cerny, had compiled mediatomb whith exiv2 support. I'm very interested in it because I don't find a method to extract IPTC information from my photos. Could you tell me how to do it???

    Thank You Very Much!