Creating a photobook from a loooot of images (the linux and android way) pt. 1

One of the things you do as a young parent is to take tons and tons of pictures of your kids. And then, since you cannot and will never look at all of them digitally, but you also don’t want to forget about all those moments you captured, you create photobooks with some of the best of those pictures. Problem is, you don’t really have the time to organize and sort them. Still, doing this quickly becomes very important once you experience how fast things go by, so here’s my “best practice” and some helpers that get me from “a looooot of files” to “a photobook” in a reasonable amount of time.

First thing is to create a date-based directory structure for your pictures. This can be automated quickly. Everytime I insert my SDcard into my laptop to copy new pictures, I run this script (click the ugly white box to see the code):



copy() {
 cp -a -v $img ${target}/${dat}/
 touch ${target}/${dat}/.$(basename $img).copiedbutdeleted
 base=$(basename $img)
 dir=$(dirname $img)
 touch ${dir}/.${base}.alreadycopied

if [ -d "$target" ]; then
 for img in $@; do
  base=$(basename $img)
  dir=$(dirname $img)
  if echo $img | grep -q alreadycopied$; then
   echo "File $i of $# $img is a control file"
  elif [ -f ${dir}/.${base}.alreadycopied ]; then
   echo "File $i of $# $img already copied."
   if [ -f "$img" ]; then
    dat=$(ls -l --time-style="+%Y%m%d" $img | awk '{ print $6; }')
    echo -n "Copying $i of $# "
    if ! [ -d ${target}/${dat}/ ]; then
     mkdir ${target}/${dat}/
     if [ -f "${target}/${dat}/$(basename $img)" ]; then
      if ! diff -q $img ${target}/${dat}/$(basename $img) &>/dev/null; then
       echo ${target}/${dat}/$(basename $img) already exists and is the same file
      if [ -r ${target}/${dat}/.$(basename $img).copiedbutdeleted ]; then
       echo $img was already copied but then deleted. Not copying again.
   fi # if [ -f "$img" ]
 echo "Usage: $0 target-dir image1 image2 ... imageN"
 exit 1

./ $HOME/Pictures/kids /media/SD-CARD/DCIM*/*

This will copy all the files from my memory card to the Picures/kids folder and create a sortable, date-basedly named, folder, eg 20141119, for all pictures from that day.

So now that I have a structure in my pictures, the next thing is to find each day’s best pictures. This is a manual process. If you do that regularly (like once a week), the work is manageable. I personally go through the pictures with the tool eog (eye of gnome) and whenever I see a “good” picture, I press CTRL+SHIFT+s and copy the good file to a subfolder named “good”. The nice thing about eog is, it remembers the previously selected “save as folder”. So when seeing the next “good” picture, it only takes a quick CTRL+SHIFT+s and then a RETURN to make a copy. To me, this is a very efficient way of finding and keeping the good pictures. This makes for a good starting point for the next photo book.

… to be continued in pt. 2


One response to “Creating a photobook from a loooot of images (the linux and android way) pt. 1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s