Remotely controlling digital cameras with gPhoto

In Charge

© hypermania2, 123RF

© hypermania2, 123RF

Article from Issue 109/2009
Author(s):

Commercial software that lets users remotely control their camera usually is not available for Linux. gPhoto gives users a free alternative.

Some vendors offer commercial add-ons to help users remotely control their cameras – for example, to take a series of photos at set intervals. Time exposures of the night sky and time-lapse photos of a growing plant are excellent choices of subject as well. However, vendors such as Canon and Nikon only offer their software for Windows and the Mac OS, and Nikon even charges for the program [1]. To make things worse, the software is closed source and not suitable for scripting, which tends to restrict its usefulness.

gPhoto

The gPhoto [2] project mainly comprises the libgphoto2 library, the gphoto2 command-line interface, and the gtkam front end (see also the "Gtkam Graphical Front End" box). The software lets users read and change the status of their digital cameras, copy files in both directions, and remotely control digital cameras.

As of this writing, gPhoto supports more than 1,100 digital camera models. A lack of cooperation on the part of camera manufacturers has forced developers to reverse engineer most of the protocol information and explains why the software does not support all of the features that are available on every single digital camera.

Although most state-of-the-art digital cameras that support simple tasks – such as transferring images – use the popular Picture Transfer Protocol (PTP) standard, the remote control protocols are typically undocumented. The examples in this article have been tested on a Canon 50D and should work with any digital camera supported by gPhoto with slight modifications (especially with Canon models).

Gtkam Graphical Front End

The gtkam graphical front end (Figure 1) currently has only a rudimentary set of functions, although it does vastly simplify image downloads. From the drop-down menu, you can select the connected digital camera and use the thumbnails to navigate through your collection of images. Gtkam does not support remote control functionality for digital cameras. Applications such as the KDE digiKam [3] tool offer more convenience than gtkam.

Data Management

Before you start working with gPhoto, determine whether your camera's transfer mode is set to PTP; otherwise, the program will not support it. To find out whether gPhoto has correctly identified your camera, type gphoto2 --auto-detect at the console to see the following output:

$ <B>gphoto2 --auto-detect<B>
Model              Port
---------------------------------
Canon EOS 50D       usb:

In this example, the software found a Canon 50D. The gphoto2 --summary command provides some basic information about the camera, including the memory card (capacity and space usage), designation, serial number, firmware version, and supported file formats. If you set the --list-files flag, you also get a listing of all the images on the memory card. To download the images, try --get-all-files. Table 1 lists a selection of file and directory management options.

Remote Control

Although file downloads work with some 1,100 digital camera models, remote control through gPhoto works with less than 10 percent [4] of them. Most of the supported models are made by Nikon and Canon, and the function is not available at all for cameras by Samsung, Sigma, and Sony.

The gphoto2 --list-config command lists all supported functions offered by the software for the connected camera. For Canon SLR cameras such as the 50D and 400D, you can add capture=on to get a full list of configuration parameters (Listing 1). The --get-config switch reads all the configuration parameters and their possible values; --set-config assigns a parameter. For example, the command in Listing 2 tells gPhoto to output all available ISO settings.

Listing 1

Listing Configuration Parameters

$ gphoto2 --set-config capture=on  --list-config
/main/settings/eos-time
/main/settings/eos-synctime
(...)
/main/imgsettings/eos-iso
/main/imgsettings/eos-whitebalance
/main/capturesettings/eos-exposurecompensation
/main/capturesettings/picturestyle
(...)

Listing 2

ISO Settings for the Canon EOS

$ gphoto2 --set-config capture=on  --get-config=/main/  imgsettings/eos-iso
Label: EOS ISO speed
Type: RADIO
Current: 400
Choice: 0 Auto
Choice: 1 100
Choice: 2 200
(...)
Choice: 6 3200

To set the ISO value to 1600, simply type gphoto2 --set-config capture=on --set-config eos-iso=1600. The supported values for configuration parameters such as the ISO setting (eos-iso), exposure compensation (eos-exposurecompensation), white balance (eos-whitebalance), or picture style (picturestyle) depend on the camera you are using. The available values for the aperture setting (eos-aperture) are driven by your choice of lens (Listing 3). Also note that the path following --get-config= must match your camera model.

Listing 3

Aperture Settings for Canon EOS

$ gphoto2 --set-config capture=on --get-config=/main/ capturesettings/eos-aperture
Label: EOS aperture
Type: RADIO
Current: 5.6
Choice: 0 1.4
Choice: 1 1.6
Choice: 2 1.8 (1/3)
(...)
Choice: 24 22

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Workspace: Netbook Photo Tools

    Find out how to turn your netbook into a fabulous photo tool.

  • Workspace: Pi-Based Backup

    With some creativity and a little scripting, you can easily turn your Raspberry Pi into an effective backup device.

  • Workspace: Photo Helpers

    Capture, transfer, process, and manage photos using the Entangle, Rapid Photo Downloader, and GTKRawGallery applications.

  • KTools: Konqueror 3.4

    Following in the tracks of previous invaders such as Navigator and the Internet Explorer, Konqueror is on a mission conquer the Internet. The KDE 3.4 version of Konqueror is a truly versatile tool that feels at home on the web.

  • Geeqie

    The image viewer Geeqie is used to view and sort image collections. The tool supports numerous formats, reads metadata, and – among other things – displays the location where you took the picture on a map.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News