Remotely controlling digital cameras with gPhoto
In Charge
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
(incl. VAT)
Buy Linux Magazine
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.
News
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.