Tips, Tutorials, Hacks

Tethered shooting on Ubuntu Linux using gPhoto2

// February 25th, 2008


Photo by Jacob Garcia

My D70, like most digital cameras, has a USB port that allows me to connect it to my computer and download photos. Many cameras also allow you to control them using your computer when they are connected. This is called tethered shooting. You click the shutter and a few seconds later the photo is displayed in all its glory on your big screen monitor. This can come in extremely handy in studio situations. It’s a great trick for quickly checking that you’re capturing the shots you want without squinting at a 2 or 3 inch LCD.

On a lark it occurred to me to do something goofy with my camera (more on that in a minute). On the way to crazy town I came up with a way to do basic tethered shooting on Linux.

I’m using Ubuntu Linux but, in theory, this should work on any Linux system that can run gphoto2. gphoto2 is a magical command line utility that lets you control your camera connected via USB cable. With it, you can download photos and even cause the camera to capture images. To install it on Ubuntu, start Synaptic and search for gphoto2.

Next, download the following scripts: Download

(These scripts are all open source and I’m releasing them under a BSD license which basically means you can do whatever you want with them.)

Uncompress them into a new folder or put them somewhere on your path. Then right click each file, open its properties, and select the Permissions tab. Make sure the “Execute” checkbox is checked.

Then, connect your camera to your computer using a USB cable, turn it on, and run the tether script by double-clicking it and choosing Run in terminal (you can do all of this at the command line as well but I figure you command line guys already know that).

Now take a photo. If all goes well, you should see it download the photo into the folder and then display it for you. Your results may vary. I’ve tested this setup with exactly one camera. If all does not go well (and let’s face it, the probability of that is definitely not zero), take a look at the troubleshooting suggestions in the README file included in the download.

So what was the goofy idea that prompted all of this? I wanted to see if I could connect my camera to my microphone. The soundtrigger script in the download works the same way as tether except it takes the photo for you when you snap your fingers. Literally. I told you it was goofy. I can’t think of many good uses for that. Maybe if you have a laptop you could set up the whole contraption outside next to a bird feeder…

10 Responses to “Tethered shooting on Ubuntu Linux using gPhoto2”

  1. Bryan Villarin says:

    Thanks for writing about this. I didn’t know this was possible! I’m not talking about on Ubuntu, but in general. I’ll try this tomorrow for kicks…

  2. parl says:

    The clapper for cameras…

  3. John Watson says:

    Ha! Exactly! :-)

  4. Donncha O Caoimh says:

    Nice, worked on my Canon 20D too, except I had to change the path, and as the drive activity light lights up every second so I increased the sleep time.

    I wonder what else it can do ..

  5. Donncha O Caoimh says:

    Oh bloody hell! This is great! I edited your soundtrigger script and removed the sound bits and the camera took a photo when I hit space.

    Oh! I’ll have fun with this!

  6. hadez says:

    tested with a Nikon D200 on Gentoo Linux
    worked out of the box.
    thanks a lot for this great script!

  7. Roel Willems says:

    Great script! Works out of the box on Ubuntu 7.10 and Nikon D70.

  8. Jimmy Cabalum says:

    Thanks for the great script!

    The only problem I had with it is that the since the script deleted the files everytime time after it copied it, the file scheme went back to whatever_1.JPG, so it gave asked me if I wanted to overwrite instead of opening up the new file. I tweaked the tether script a bit so that it saves the files as 1.jpg, 2.jpg, 3.jpg, and so forth, so each picture is saved and pops up on your screen, without asking you if you want to overwrite. I also tweaked the view script to open up Eye of Gnome in full screen.

    I didn’t do anything with the soundtrigger script, but I’m sure it could easily be adapted. Here’s my revisions in case anyone else would like to use them:
    http://rapidshare.com/files/110692141/tether.tar.gz.html

  9. jason says:

    Make sure to put the camera to PTP mode from the Mass Storage Mode, in my case for Nikon D70. I spent hours trying to find out why the gphoto2 –auto-dectect does not work. After I put the Camera to PTP mode from M mode(Mass storage), it works great. It should have been mentioned in the article.
    Anyhow, thank you very much. This is what I have been looking for to shoot the home studio indoor portraits.

    Thank you.

  10. jason says:

    BTW, my Linux is fedora8, and I am using the preinstalled gphoto2, the one you can install using add/remove program.s

Leave a Reply