A set of scripts to automate portrait photography with QR codes.
Python PHP
Latest commit 23a4292 May 15, 2012 Robert Bieber Switched thumbnail naming to filename_thumb.jpg


Copyright 2012, Robert Bieber

This is a set of scripts I'm building to automate a mass portrait shoot with 
QR codes.  The basic idea is that I'll first generate a bunch of small cards, 
each with a unique number and a QR code corresponding to that number.  I'll then
hand the cards to each successive client, taking a single photograph clearly 
showing the QR code before beginning their session.  Afterwards, after doing a 
batch RAW conversion on the images I'll split them up into directories using 
the QR code images, and then dump them onto a web server with a small PHP 
script to display them to clients.  

Each step of this process will be handled by a separate script, and I'll 
document them here as I go along.  The scripts themselves are found in the 
scripts/ directory.

gencards.py - Generates a PDF file containing the desired number of number/QR
cards.  Usage is simply:

  gencards.py <number of cards> <output file>

The layout of the cards is fully customizable, but configuration is done through
constants in the script itself.  You'll find all the relevant settings towards 
the top of gencardYs.py under the section "User Parameters."  An example of a set
of cards generated with the default settings is included in 

This script requires python, the reportlab PDF generation library for Python, 
and the qrencode command.

sortphotos.py - Sorts photos into directories corresponding to their serial 
number, doing RAW conversion along the way if necessary.  Usage is

  sortphotos.py <input directory> <output directory>
Photos will be copied into the output directory in subdirectories named with the
code that preceded each photo.  The input directory will be recursively 
scanned for photographs, and if there are RAW files then they will be converted 
using the .ufraw file found most recently in the directory tree.

This script requires ZBar, ImageMagick and UFRaw (if converting RAW files).

genthumbs.py - Generates thumbnails for a sorted set of photos.  Usage is

    genthumbs.py <input directory> <width> <height>
Thumbnails will be generated such that width x height is the maximum size.  This
script generates thumbnails named to match the web viewer's expectations.  It's 
generally a good idea to use this script to generate thumbnails rather than 
letting the web viewer do it, because they're better quality this way and 
thumbnail generation can seriously slow down the web viewer, potentially 
running you up against PHP's time and memory limits as well.

This script requires ImageMagick.