Building a Photo Booth: Part II

In the first installment, I went over the basic setup of my Rpi which is the brain of the photobooth. Today, I am installing some software to process photos, and writing a script which will take, edit and print the photos.

Editing Pictures I will be using ImageMagick to edit the photos. ImageMagick is a powerful suite of image manipulation tools which can be run entirely from the command line, making it perfect for the photobooth. To install ImageMagick on the Rpi, run the command sudo apt-get install imagemagick

ImageMagick includes a tool called “mantage” which combines several images into a single image. I wrote a simple shell script which takes 4 pictures at regular intervals, then combines the images into a single picture:

#!/bin/sh
# Filename: take-photos
# Description: takes 4 photos at regularly spaced time intervals
# and combines the images into a single 2 x 2 montage

# Take 4 pictures with 1 second delay between the pictures
raspistill --width 504 --height 504 --timeout 5000 --quality 75 --output pic1.jpg  
raspistill --width 504 --height 504 --timeout 1000 --quality 75 --output pic2.jpg  
raspistill --width 504 --height 504 --timeout 1000 --quality 75 --output pic3.jpg  
raspistill --width 504 --height 504 --timeout 1000 --quality 75 --output pic4.jpg

# Combine images into a single montage
montage pic[1-4].jpg -tile 2x2 -geometry 504x504+4+4 tile.jpg  
convert tile.jpg -density 256 tile.jpg  

Here is the output of my first test using take-photos:

20140601-120655-43615094.jpg

Next time, I will go over how to automatically upload the photos to Flickr.

Will Rosenbaum

Tel Aviv

comments powered by Disqus