Using Raspberry Pi as a Photo Station

Dmitri Popov

Productivity Sauce

Sep 24, 2012 GMT
Dmitri Popov

Although Raspberry Pi (RPi) is not powerful enough for heavy-duty image processing, you can still put it to some photography-related uses. For example, as an amateur photographer, I take a lot of photos when I travel, and I upload the photos to my Raspberry Pi at home which neatly organizes and keeps them safe till I get back home.

To turn RPi into a photo station, I opted for the Debian Wheezy minimal image. The only thing I needed to install was the usbmount tool which automatically mounts and unmounts external USB storage devices. Although it's possible to save photos on the SD card, I decided to keep them on a dedicated 16GB USB stick which usbmount tool mounts at /media/usb0. Since the minimal image comes with an SSH server enabled by default, I only had to configure my router to make RPi accessible from the Internet.

Usually I use the Eye-Fi with my DSLR camera to automatically transfer photos to whatever Android device I have on me. I then use the FolderSync app to upload photos to the /media/usb0/Eye-Fi directory on RPi using the SFTP protocol.

RPi then uses a simple Bash script to rename the transferred photos and organize them into folders by date. The script relies on the ExifTool which can be installed using the sudo apt-get install libimage-exiftool-perl command. The script itself is not particularly complicated:

#!/bin/bash
SRC=/media/usb0/Eye-Fi
DEST=/media/usb0/PHOTOS
if [ "$(ls -A $SRC)" ]; then
 cd $SRC
 exiftool -r -d $DEST/%Y%m%d/%Y%m%d-%H%M%S.%%e "-FileName<DateTimeOriginal" -ext NEF $SRC
else
 echo "No photos found"
fi

The scripts renames each RAW file using the date and time info from the file's EXIF metadata, and organizes the renamed photos by date. Note that this particular example works with Nikon's NEF RAW files, so you have to specify the correct file extension to make the script work with other formats. I usually run the script manually, but you can create a cron job to run it automatically at a specified schedule. Just remember to make the script executable using the chmod +x .rename.sh command (replace rename.sh with the actual name of the script).

This is not the most advanced solution, but it serves me well when I'm out and about.

Comments

  • Re: Wrong variable name

    Fixed. Thanks for spotting the error!
  • Wrong variable name

    $SOURCE should be $SRC int the if statement
comments powered by Disqus

Issue 167/2014

Buy this issue as a PDF

Digital Issue: Price $9.99
(incl. VAT)

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia