It’s almost Valentine’s Day, and, long story short, I volunteered to run a “photobooth” for my kid’s school class party. The props and backdrop were easy enough, but who really wants to use an expensive Polaroid-type film camera these days? So I cooked up another solution. What if I could use a digital camera, transfer photos wirelessly to my laptop and display them in an almost real-time slideshow on a large screen that the classroom already had? Awesome!
I happen to have a Nikon D5500 DSLR camera, which has a WiFi function built in. I’ve never actually used this in-built WiFi feature, but as it turns out, it’s pretty much perfect for this usecase. By default, it runs its own WiFi hotspot that you can connect to from your phone or laptop. The apps for both mobile and desktop they provide are totally terrible though, bordering on unusable. Luckily, open source to the rescue! The camera speaks PTP over IP (PTP/IP). There’s a program / library called gphoto2 that comes with a tool that can easily sync new photos directly to a folder. In theory you could also use something else like a Toshiba FlashAir WiFi SD card to transfer the image files across if your camera doesn’t support WiFi natively.
Assuming you’ve set up and enabled your camera WiFi hotspot and connected to it from your computer, you can then run this gphoto command to wait for events from the camera, including waiting on any completed photo captures, and immediately copy those images across the WiFi:
gphoto2 --port ptpip:192.168.1.1 --keep --wait-event-and-download
Great! Now all we need to do is display these images. I wanted something fullscreen and something to show the latest images straight away, for the shortest possible feedback loop between taking the photo and seeing it on the big screen. I added some “display the latest images” logic to a pretty simple python script that uses pyglet, an OpenGL python framework, as it was the easiest way I could find to get a fullscreen image display on MacOS.
The process the display script uses is:
The python collections.Counter module made tracking the view counts pretty easy. To make the photobooth even more fun, I also grabbed one of those simple infra-red remote triggers so the people in the photos can push the trigger themselves.
The biggest benefit of all of this is the kids get some great photos saved straight away into digital form that can be then easily shared with parents and friends. I hope they all enjoy being the ‘customers’ of this little photo booth idea!