This simple python script allows batch uploading of photos from digiKam photo organizer to Picasa Web Albums service. The idea is pretty simple - tag the photos inside digiKam with specific tag (e.g. "web") and then run a script that creates new album in your Picasa Web account and uploads the tagged photos automatically. The script also resizes the images to a resolution suitable for viewing on a screen (1280x1024) to save space and speed up the upload. It utilizes the gdata-python-client API from Google to upload the photos, Python Imaging Library (PIL) for resizing and pysqlite for accessing the digiKam database. The script also supports uploading files from the file system
How to install
- Make sure you have Python and required library packages. If you are running Ubuntu Linux it is easy as:
$ sudo apt-get install python python-imaging python-pysqlite2 jhead
The last package (jhead) is required to copy metadata from original images to resized ones. It is optional (but highly recommended) to install
- Download the gdata-python-client library tar ball. It has several dependencies: ElementTree, httplib, urllib modules. In Ubuntu all of them happen to be a part of standard
python2.5package, but in other distributions you might have to install additional packages. Next, unpack the gdata tarball and run:
./setup.py install --prefix=/usr/local
- Download and save digikam_picasa.py script.
- That's it - lets use the script!
Lets try to upload few images from file system first. All you need to do is to specify the credentials for accessing the service (username, password), the album name and the files:
$ python digikam_picasa.py -u email@example.com -p secret -a NewAlbum -f IMG_0001.JPG
This command will upload the image IMG_0001.JPG from the current directory into a new album called NewAlbum.
Now, lets upload the photos tagged with "web" in the digikam. You need to specify the the digikam's database file -
digikam3.db. It is located in the root of directory digiKam uses to store the images (Settings > Configure > Albums > Album Library Path):
$ python digikam_picasa.py -u firstname.lastname@example.org -p secret -a NewAlbum -t web -d /media/data/photos/digikam3.db
This command will upload all photos tagged with "web" in the digiKam. If you want to upload images with different tag, just change the -t parameter.
If you want to change the default image size (1280x1024) you can change the width and height parameters in the script's source.
This script is heavily derived from the script written by Marcin Sochacki and Ulrik Stervbo. On this page you can find alternative projects for automating the upload to Picasa Web Service