Thursday, April 7, 2011

My First HDR Photo!

So almost a year ago I made a post about HDR photography, well I finally got a chance to try it!

I had to tweak my script a bit, but I now have it so it takes 5 photos of varying exposures and then pulls the thumbnails of those photos off the camera to be previewed. It took a little while to get working but I set the camera up on the tripod and took a few shots as the sun was setting and the results aren't too bad! I didn't do the HDR overlay manually instead I used HDRtist for Mac to make it easy.

So here it is!!

And now some geeky stuff!

My script that I used is below

#! /bin/bash

# Take the 5 photos
gphoto2 --auto-detect
gphoto2 --set-config shutterspeed=15 \
--capture-image \
--set-config shutterspeed=17 \
--capture-image \
--set-config shutterspeed=20 \
--capture-image \
--set-config shutterspeed=25 \
--capture-image \
--set-config shutterspeed=30 \

# Get the folder location
mydir=$(gphoto2 -l | grep 'There are 0 folders in folder' | awk '{print $7}')
mydir=$(echo ${mydir%\'.})
mydir=$(echo ${mydir#\'})

# Get the photo number range for the 5 photos
endnum=$(gphoto2 -n -f=$mydir | grep ':' | awk '{print $7}')
startnum=$[ $endnum - 4 ]

# Pull thumbnails of the 5 photos
gphoto2 -t=$startnum-$endnum

As you can see it's a bit different than the one I made before, but it still requires gphoto2 which can be found online or installed with apt-get if you're an Ubuntu user.


  1. I'm hoping to use gPhoto2 on a Raspberry Pi( running Raspbian “wheezy” Linux on an SD card.

    I've got the whole system setup and I can send commands to my Nikon D40 easily. But I'm a bit lost going about what I'm trying to accomplish.

    I want to use the RPi to control my D40 for bracketed exposures. I cam across your script and it works great from the RPi. What I'm confused about is how to determine what the camera's current exposure and aperture might be so that I can programmatically compute the bracket exposure values. Can you provide some guidance?

    1. Ironically enough, I just got my Raspberry Pi this past weekend and have Rasbpian installed. I was going to try to set up gPhoto2 this weekend actually, so good to know it works!

      So, as you can see in my script I'm just setting the shutter speeds for my exposure times with --set-config. You can use --get-config to fetch the shutter speed as well and then bracket from that value.