A script to migrate Picasa metadata from its .picasa.ini
files and/or contacts.xml
file to the
digiKam database.
It does not require Picasa to be installed and therefore does not require Windows.
It does not write into the original Picasa file system, so the original files should remain untouched.
.picasa.ini
file (so this script won't do anything). digiKam is able to
import these tags properly. In fact, you could run this Picasa feature on all your photos (which takes forever and
touches every single file on disk, which might not be desirable) as an alternative way of migrating your face
tags.contacts.xml
?%LocalAppData%\Google\Picasa2\contacts\contacts.xml
$Application Data\Google\Picasa2\contacts\backup.xml
Clone the repository and cd
into it.
Make sure you have Python 3.10 or newer installed.
Install pip3 install psutil
. On Windows, also pip3 install pywin32
.
This script writes into the digiKam database. If you already have photos in digiKam, you should at least make a backup. Furthermore, testing shows this script works best when writing into an "empty" digiKam instance. If you already have faces identified prior to running this script, you might get duplicate entries if the digiKam name does not match the name this script found.
You may also want to make a backup of the photo directories, though the script doesn't write there. Depending on your metadata sync settings in digiKam, digiKam itself may (or not) write some of the added metadata to EXIF tags in your photos.
./main.py --dry_run \
--photos_dir='/home/user/Pictures' \
--digikam_db='/home/user/snap/digikam/common/digikam4.db' \
--contacts='/mnt/WinDrive/Users/user/AppData/Local/Google/Picasa2/contacts/contacts.xml'
And when using the Windows Command Prompt (cmd), it might look like this:
python main.py --dry_run ^
--photos_dir="C:\Users\user\Pictures" ^
--digikam_db="C:\Users\user\Pictures\digikam4.db" ^
--contacts="%LocalAppData%\Google\Picasa2\contacts\contacts.xml"
In this command, --photos_dir
must point to the same directory you configured in step 3 above, or a sub-directory
thereof, and --digikam_db
must point to the digikam4.db
file under the directory configured in step 2 above.
--contacts
is optional but highly recommended.
--dry_run
to carry out the migration.The script writes to the digikam4.db
file and creates a backup. However it is also recommended you make a backup too.
contacts.xml
usually contains more accurate name information, so locate and provide the file path to it if possible.
In large old collections, there may be some inconsistencies between .ini files due to crashes in Picasa, manual moving,
etc. A lot of inconsistencies can be resolved by using the contacts.xml
file. If no contacts.xml
is available, this
script tries to work around some of these issues. For example:
In the rare instance where a face was identified in the .ini file without a corresponding name in either .ini or
contacts.xml
, this script generates a name using the hashed contact ID in the form of
.NoName-[hashed-contact-id]-from-rect64
. E.g. .NoName-da61ef7edfd692c5-from-rect64
In another rare instance where a face was identified multiple times in .ini files, this script generates a guessed name
using a concatenation of all the sorted names found separated by |
. E.g. Marcia|Marsha|Marshia|