[Digikam-users] R: Import labels tree from external files

Michael G. Hansen mike at mghansen.de
Wed Nov 25 14:19:41 GMT 2009


Marco Uliana wrote:
> Thanks for your answers
> Some points: 
> -          my system says that the help file does not exist. Where can I get
> such a file?
> -          I want just to import my tag hierarchy (I will manually tag
> images)
> -          My tag hierarchy will contain more than 10000 terminal branches
> and hundreds of intermediate branches so:
> o   Is it possible to quickly apply all these tags to a dummy image as
> suggested by, Michael G. Hansen, and then use them to tag the rest of my
> images?

I just tried it with 1110 tags and it worked. You will have to split
your 10k tags into several images, because XMP appears to be limited to
65536 bytes (it contains not only the tags, but also XMP markup around
each tag, which can be considerably more!). Digikam did not respond for
about 20 seconds when reading the tags from the image.

Of course you will need some way to convert your tag-data into the
format for exiv2, probably using some sort of script. And backup the
database before you do the import, in case anything goes wrong.

Greetings,

Mike


Short C++ program to generate tags for testing:


#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main(int argc, char* argv[])
{
    ofstream outstream;
    outstream.open("bla1.cmd");

    int counter = 1;
    for (int i = 0; i<10; ++i)
    {
        std::string istring = "a";
        istring[0]+=i;
        outstream<<"set Xmp.digiKam.TagsList["<<counter<<"]
"<<istring<<endl;
        counter++;

        for (int j=0; j<10; ++j)
        {
            std::string jstring = "a";
            jstring[0]+=j;
            outstream<<"set Xmp.digiKam.TagsList["<<counter<<"]
"<<istring<<"/"<<istring<<jstring<<endl;
            counter++;

            for (int k=0; k<10; ++k)
            {
                std::string kstring = "a";
                kstring[0]+=k;
                outstream<<"set Xmp.digiKam.TagsList["<<counter<<"]
"<<istring<<"/"<<istring<<jstring<<"/"<<istring<<jstring<<kstring<<endl;
                counter++;
            }
        }
    }
    outstream.close();
    return 0;
}




-- 
Michael Hansen - mike at mghansen.de
http://www.pfna.de/



More information about the Digikam-users mailing list