[Digikam-users] Importing photos to DigiKam

Duncan Hill dhill at cricalix.net
Fri Jun 16 14:55:15 BST 2006


On Fri, June 16, 2006 13:37, Dotan Cohen wrote:
> On 16/06/06, Duncan Hill <dhill at cricalix.net> wrote:
>
>> On Fri, June 16, 2006 10:34, Dotan Cohen wrote:
>>
>>> I have several hundered photos that were tagged in a Windows program
>>> (BrilliantPhoto). I can extract the tags with a script and create an
>>> SQL dump for the tags. How can I import that SQL dump to the sqlite
>>> database in DigiKam, and what are the tables?
>>
>> Use the source Luke!  Or just run sqlite3 against digikam.db and dump
>> the table structure.  Or knoda as suggested elsewhere.
>>
>
> Thank you. I'm not a developer and don't really understand what I have
> to do, but now I know at least what I have to google: sqlite and knoda.
> Thanks.

Ah, well then, I'll supply more information :)

SQLite is a lightweight single-file approach to a relational database. 
digiKam uses it to store all of the data relating to albums and images. 
You can't use a text editor to view it.

~/Images$ sqlite3 digikam3.db
SQLite version 3.2.8
Enter ".help" for instructions
sqlite> .help

sqlite> .tables
Albums           ImageTags        Searches         Tags
ImageProperties  Images           Settings         TagsTree

sqlite> .schema Images
CREATE TABLE Images
 (id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  dirid INTEGER NOT NULL,
  caption TEXT,
  datetime DATETIME,
  UNIQUE (name, dirid));
CREATE INDEX dir_index ON Images    (dirid);
CREATE TRIGGER delete_image DELETE ON Images
BEGIN
  DELETE FROM ImageTags
    WHERE imageid=OLD.id;
  DELETE From ImageProperties
     WHERE imageid=OLD.id;
  UPDATE Albums SET icon=null
     WHERE icon=OLD.id;
  UPDATE Tags SET icon=null
     WHERE icon=OLD.id;
END;
sqlite> .schema Imagetags
CREATE TABLE ImageTags
 (imageid INTEGER NOT NULL,
  tagid INTEGER NOT NULL,
  UNIQUE (imageid, tagid));
CREATE INDEX tag_index ON ImageTags (tagid);

sqlite> select * from Images;
10|image1.png|1||2005-10-19T07:58:24
11|image2.png|1||2005-10-19T07:58:38
12|image3.png|1||2005-10-19T07:58:53

Suggest that you make a copy of your .db file somewhere else, and play
with the copy.  I don't have any tags applied on this machine, so my
imagetags table is empty.

If you're using Debian or a derivative like Ubuntu, it should be as easy
as (cli at least)
sudo apt-get install knoda libhk-classes-sqlite3

Whoa.. I just tried knoda.  Nice!




More information about the Digikam-users mailing list