Gphoto2 command line interface

The data below has been obtained from a Canon EOS 1000D camera.

Gphoto2 can be used interactively with commands or using command line arguments, the result is the same. Interactive commands are generally the same than commande line arguments without the double dash before them. On this page, commands line arguments are used.

The camera being addressed must be specified for all commands, either using the --auto-detect option or one of --camera or --port.

Changing properties

Properties are the same parameters used to take a picture, for example shutter speed and ISO value. A list of available parameters for a camera can be obtained using the --list-config option or command. Result is shown below.

$ gphoto2 --auto-detect --list-config
----------------------------------------------------------
Canon EOS 1000D                usb:001,009     
/main/actions/bulb
/main/actions/uilock
/main/actions/syncdatetime
/main/actions/autofocusdrive
/main/actions/manualfocusdrive
/main/actions/eoszoom
/main/actions/eoszoomposition
/main/actions/eosviewfinder
/main/settings/datetime
/main/settings/reviewtime
/main/settings/output
/main/settings/evfmode
/main/settings/ownername
/main/settings/customfuncex
/main/settings/capturetarget
/main/settings/capture
/main/status/model
/main/status/ptpversion
/main/status/dpofversion
/main/status/batterylevel
/main/status/serialnumber
/main/status/shuttercounter
/main/status/availableshots
/main/imgsettings/imageformat
/main/imgsettings/imageformatsd
/main/imgsettings/iso
/main/imgsettings/whitebalance
/main/imgsettings/whitebalanceadjusta
/main/imgsettings/whitebalanceadjustb
/main/imgsettings/whitebalancexa
/main/imgsettings/whitebalancexb
/main/imgsettings/colorspace
/main/capturesettings/autoexposuremode
/main/capturesettings/drivemode
/main/capturesettings/picturestyle
/main/capturesettings/shutterspeed
/main/capturesettings/meteringmode
/main/capturesettings/bracketmode
/main/other/d402
/main/other/d407
/main/other/d406


Getting the value and possible values for a property is done using the --get-config argument. Here is an example with the shutter speed property.

Type: RADIO
Current: 30
Choice: 0 bulb
Choice: 1 30
Choice: 2 25
Choice: 3 20
Choice: 4 15
Choice: 5 13
Choice: 6 10
Choice: 7 8
Choice: 8 6
Choice: 9 5
Choice: 10 4
Choice: 11 3.2
Choice: 12 2.5
Choice: 13 2
Choice: 14 1.6
Choice: 15 1.3
Choice: 16 1
Choice: 17 0.8
Choice: 18 0.6
Choice: 19 0.5
Choice: 20 0.4
Choice: 21 0.3
Choice: 22 1/4
Choice: 23 1/5
Choice: 24 1/6
Choice: 25 1/8
Choice: 26 1/10
Choice: 27 1/13
Choice: 28 1/15
Choice: 29 1/20
Choice: 30 1/25
Choice: 31 1/30
Choice: 32 1/40
Choice: 33 1/50
Choice: 34 1/60
Choice: 35 1/80
Choice: 36 1/100
Choice: 37 1/125
Choice: 38 1/160
Choice: 39 1/200
Choice: 40 1/250
Choice: 41 1/320
Choice: 42 1/400
Choice: 43 1/500
Choice: 44 1/640
Choice: 45 1/800
Choice: 46 1/1000
Choice: 47 1/1250
Choice: 48 1/1600
Choice: 49 1/2000
Choice: 50 1/2500
Choice: 51 1/3200
Choice: 52 1/4000


Setting the property is done using --set-config argument, as shown below. There is generally no output to this command.

$ gphoto2 --auto-detect --set-config=/main/capturesettings/shutterspeed=0
Model                          Port                                            
----------------------------------------------------------
Canon EOS 1000D                usb:001,009     

Taking a picture

There are numerous ways of taking pictures with Canon EOS cameras. Images can be stored on temporary internal memory or on SD card. Image with long exposure can be done using predefined length exposures, or bulb mode. The bulb mode can be controlled from two ways in gphoto2: setting the /main/actions/bulb property to 1 then 0 during the exposure, or using the -B command line argument.

For example, an 22s image can be downloaded right away to the computer, and not be written on the SD card, using the --capture-image-and-download argument in combination with the -B argument. The -B argument can only work when the camera is in M mode and its shutter speed is set to BULB. The captured image is then saved in the local directory, so be sure you can write to it.

$ gphoto2 --auto-detect -B 22 --capture-image-and-download
Model                          Port                                            
----------------------------------------------------------
Canon EOS 1000D                usb:001,009     
Bulb mode enabled (exposure time: 22s).
New file is in location /capt0000.cr2 on the camera                            
Saving file as capt0000.cr2
Deleting file /capt0000.cr2 on the camera
Deleting 'capt0000.cr2' from folder '/'...


Numerous options can then be added to this command line, for example the --interval option to take several pictures, or --filename to change the output filename, inserting date or number in it. Warning, the %n number is restarted to 0 when gphoto2 launches, so it can be used only for continuous capture or interactive command line.