2.2. Using the gphoto2 command line interface (CLI)

OK, we begin with finding out how you can connect a camera to your computer:

alice@host:~$ gphoto2 --list-ports
Devices found: 4
Path                             Description
--------------------------------------------------------------
serial:/dev/ttyS0                Serial Port 0                   
serial:/dev/ttyS2                Serial Port 2                   
serial:/dev/ttyS3                Serial Port 3                   
usb:                             Universal Serial Bus	  
alice@host:~$ 
      

In this example, we see that we have the three serial devices /dev/ttyS0, /dev/ttyS2 and /dev/ttyS3 which are configured properly and to which gphoto2 has write permissions for. Additionally, there is also a USB bus. However, we cannot tell yet whether we will have write access to the USB device file your camera will be assigned by your operating system.

The next step is to connect your camera and find out whether the gphoto2 can find it. This only works with USB. If you are using a camera that connects over RS232, then you need to specify the model explicitly: gphoto2 cannot detect serial cameras (unlike USB, RS232 ports are dumb).

alice@host:~$ gphoto2 --auto-detect
Model                          Port                                             
----------------------------------------------------------
Canon PowerShot G2             usb:            
alice@host:~$ 
      

In this case, a camera called Canon PowerShot G2 is connected to your system's USB bus.

If your camera is a Kodak EasyShare™ and if you use the dock, then you need to press the button to have the camera detected by the computer.

OK, so now let's see what we can find out about the camera:

alice@host:~$ gphoto2 --summary
Detected a 'Canon PowerShot G2'.                                                
Camera Summary:

Camera identification:
  Model: Canon PowerShot G2
  Owner: Alice Smith

Power status: on battery (power OK)

Flash disk information:
  Drive D:
   31'885'312 bytes total
   27'668'480 bytes available

Time: 2002-07-09 20:45:15 (host time +0 seconds)

alice@host:~$ 
      

The actual result of gphoto2 --summary may be different from camera to camera. However, we can see that gphoto2 obviously can talk to the camera, and we get some information about the camera.

OK, now that we have seen that there is some space occupied on the storage medium of the camera, let's have a look at what is stored there:

alice@host:~$ gphoto2 --list-files
Detected a 'Canon PowerShot G2'.                                                
There are no files in folder '/'.
There are no files in folder '/DCIM'.
There are 4 files in folder '/DCIM/154CANON':
#1     CRW_5417.CRW               rd  2334 KB image/x-canon-raw
#2     IMG_5415.JPG               rd  1044 KB image/jpeg
#3     IMG_5416.JPG               rd    31 KB image/jpeg
#4     MVI_5418.AVI               rd   682 KB video/x-msvideo
There are no files in folder '/DCIM/CANONMSC'.
alice@host:~$ 
      

There are multiple folders on the camera, and there are several files of different types and sizes on stored in one of them. One is a raw file of the type this camera produces, two are JPEG files (one large and one small) and one seems to be a short video sequence.

Now that we have an impression of what expects us when we actually download the images from the camera, we are going to do that:

alice@host:~$ gphoto2 --get-all-files
Detected a 'Canon PowerShot G2'.                                                
Downloading 'CRW_5417.CRW' from folder '/DCIM/154CANON'...
Saving file as CRW_5417.CRW                                                     
Downloading 'IMG_5415.JPG' from folder '/DCIM/154CANON'...
Saving file as IMG_5415.JPG                                                     
Downloading 'IMG_5416.JPG' from folder '/DCIM/154CANON'...
Saving file as IMG_5416.JPG                                                     
Downloading 'MVI_5418.AVI' from folder '/DCIM/154CANON'...
Saving file as MVI_5418.AVI                                                     
alice@host:~$ 
      

And now we have all the files in our current directory (in this case in directory ~) and can do something with them.

Well, that's about it. You may also want to have a look at the command line examples from the gphoto2(1) man page.