Import Photos Script

I used to use a script to copy my files from my digital camera memory card to my computer. Since recent Ubuntu releases use gnome-volume-manager to automatically prompt you with a Photo Import dialog when you insert your memory card, I never bothered using my script.

Photo Card Detected

If it was just a memory card over USB (as opposed to a digital camera over USB), then all this would do is open the memory card’s DCIM folder in gthumb and you would have to manually copy the files over. This has irritated me for a while, because I wanted the process to be as automated as possible. So… I spent most of the night battling Bash and playing with Zenity to create a new script. Behold!

Once installed, after you click Import Photos, you should get this screen to select the destination forlder.

Select Destination

Once you’ve done that, it should jump straight to copying the files.

Copying Files...

When it’s finished, it will ask you if you want to browse the fresh files with your favourite photo program, which you set in the script.

Browse new photos?

Clicking OK will open the destination directory in your program of choice (gthumb, by default). Clicking Cancel will put a notification in the notification area with a bubble saying where the photos were copied to.

That’s it!

My old script also used jhead to rename the files according to date in the EXIF data, but I didn’t want to create a dependency on jhead. Maybe I’ll add that later, as an option.

Installation…

…couldn’t be simpler.

  1. Download the script to a sensible place. (I use ~/bin)
  2. Make sure you have executable permissions on it.
    chmod +x import-photos

  3. Go to gnome-volume-properties and change the command for Digital Camera from
    gnome-volume-manager-gthumb %h
    to the path to the import-photos script with the same parameter
    ~/bin/import-photos %h
    gnome-volume-properties

    In Ubuntu, you can access this window with:
    System > Preferences > Removable Drives and Media
    :
    uh oh.  I notice a typo!

  4. You should be done. 🙂

Guess I’d better study for my math midterm, now. 🙁

Update (2006/06/06):

Looks like this issue (lack of USB mass storage support in gphoto2) can be resolved simply by using bleeding-edge libgphoto2 package in Dapper. *gasp!* Davyd has built some packages and reports success. (Too bad I read his entry after writing the script….) Actually, I’m not sure I won’t continue using this script; it has some advantages. Maybe.

The first thing I want to do with pictures on my memory card is get them off of the memory card! I don’t need to see them, I’ll browse and edit them locally – it’s faster. The script currently copies all .jpg, .avi, .mov, and .mpg files found in the DCIM folder (and subfolders). As soon as the script has finished, I can unmount my memory card and plug it back into my camera, where it belongs. I don’t have to copy movie files in a seperate step. I will definitely try out the packages when I get a bit of time, though, because I honestly don’t know what I’m missing. Does it gphoto2 copy .avi files?

Regardless, it was a good experience writing it. 🙂


Information about this entry:

Leave a Comment

Allowed code: <a href="" title="">, <abbr title="">, <acronym title="">, <b>, <blockquote cite="">, <cite>, <code>, <del datetime="">, <em>, <i>, <q cite="">, <s>, <strike>, <strong>