April 26, 2019

Using gPhoto2 to Download From Cameras

Simple and Fast

  • January 16, 2009
  • By Bruce Byfield

Uploading photos from your digital cameras is file management -- and file management in GNU/Linux is always faster from the command line, at least after you learn how. That's why, although all sorts of graphical interfaces are available for working with digital cameras, including digiKam, gtkam, and F-Spot, learning to use gPhoto2 is worth the effort. Developed in tandem with libgphoto2, the library that all the camera applications rely on, gPhoto2 not only works when the graphical alternatives fail (as happened to me recently), but gives you greater control over your cameras.

gPhoto2 has been around for a few years now. Consequently, it contains many options that you are unlikely to need today. In most cases, you can connect your camera to a USB port, and gPhoto2 will automatically detect it, and store basic configuration information in .gphoto/settings in the directory of the current account.

However, if necessary, you can take advantage of a number of options. Usually, adding --auto-detect after the basic command will identify any camera attached to your system. If it doesn't, though, you can find the information that may get you started using one of the list commands (--list-cameras, --list-ports, --list-folders, or --list-files, the last two referring to folders and files in the camera's memory). If you need to, you can also access information stored in the camera using --storage-info or manual.

Downloading options

Armed with this information, you can run the gphoto2 command with the options necessary to make it work, specifying the USB port with --port path, or the camera with --camera model. When specifying the camera, though, be sure to enclose the model in quotations if the model name contains any spaces.

Once your machine detects the camera, you will probably want to run gphoto22 --list-files to see what files are on its memory chip. Assuming you are working with a still camera, you can then download files, thumbnails, or raw data. In each case, you can either download all, or a range of what's available. The structure all these commands is very similar, so that the option to download all files is --get-all-files, while the option to download a range of files is --get-files range and to download a range of raw data, --get-raw-data range. You also have the option of using --new to obtain only the files that are not in the download directory.

Most Popular LinuxPlanet Stories