gphoto2 quick start

gphoto2 supported cameras is here


Knowing total number of shooting is important for DSLR camera. Camera shutter is electro-mechanical device that eventually wear out. Camera Shutter Life Expectancy Database has statistics for camera models.


Model Shutter Durability Rating
Canon EOS Rebel T4i / 650D n/a
Canon EOS Rebel T3i / 600D n/a
Canon EOS Rebel T2i / 550D n/a
Canon EOS Rebel T1i / 500D 100,000
Canon EOS Rebel T3 / 1100D n/a
Canon EOS Rebel XSi / 450D 100,000
Canon EOS Rebel XS / 1000D 100,000
Canon EOS Rebel XTi / 400D 50,000
Canon EOS Rebel XT / 350D 50,000
Canon EOS 60D 100,000
Canon EOS 50D 100,000
Canon EOS 40D 100,000
Canon EOS 30D 100,000
Canon EOS 20D 50,000
Canon EOS 7D 150,000
Canon EOS 6D 100,000
Canon EOS 5D Mark III 150,000
Canon EOS 5D Mark II 150,000
Canon EOS 5D 100,000
Canon EOS 1D X 400,000
Canon EOS 1D Mark IV 300,000
Canon EOS 1D Mark III 300,000
Canon EOS 1D Mark II N 200,000
Canon EOS 1DS Mark III 300,000
Canon EOS 1DS Mark II 200,000

$ gphoto2 --get-config=/main/status/shuttercounter
Label: Shutter Counter
Type: TEXT
Current: 15153

Show basic camera features
$ gphoto2 --abilities
Abilities for camera : Canon EOS 1000D
Serial port support : no
USB support : yes
Capture choices :
: Image
: Preview
Configuration support : yes
Delete selected files on camera : yes
Delete all files on camera : no
File preview (thumbnail) support : yes
File upload support : yes

Since I began to shoot time lapse photos, the number of photos became mind boggling. Total number of photos per day had been around one hundred. Now those good days are gone.

Last night when I checked the camera, it had 5,661 photos. Using gtkam, a GUI camera interface program, eats up valuable time review and download the photo images. Sometimes it freezes without any error message. So I decided to use gphoto2.

Installation is simple.

$ sudo install gphoto2

To check connection with the camera, run gphoto2 -l

$ gphoto2 -l
There is 1 folder in folder '/'.
- store_00020001
There are 2 folders in folder '/store_00020001'.
There is 1 folder in folder '/store_00020001/DCIM'.
- 100CANON
There are 0 folders in folder '/store_00020001/DCIM/100CANON'.
There are 0 folders in folder '/store_00020001/MISC'.

To get the camera infomation, run gphoto2 –summary.

Downloading all photos

$ gphoto2 --get-all-files

To download photos within range, use ‘–get-file start-end’ option.

$ gphoto2 –get-file 5513-5661

When photo images are saved as RAW + JPEG, correct image range should be image number x two. For example, to download images from 63 to 70, the range is 126-140.

$ gphoto2 -p 126-140
Downloading 'IMG_0063.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0063.JPG
Downloading 'IMG_0064.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0064.CR2
Downloading 'IMG_0064.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0064.JPG
Downloading 'IMG_0065.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0065.CR2
Downloading 'IMG_0065.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0065.JPG
Downloading 'IMG_0066.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0066.CR2
Downloading 'IMG_0066.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0066.JPG
Downloading 'IMG_0067.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0067.CR2
Downloading 'IMG_0067.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0067.JPG
Downloading 'IMG_0068.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0068.CR2
Downloading 'IMG_0068.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0068.JPG
Downloading 'IMG_0069.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0069.CR2
Downloading 'IMG_0069.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0069.JPG
Downloading 'IMG_0070.CR2' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0070.CR2
Downloading 'IMG_0070.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_0070.JPG

To read image files within range

$ ls IMG_5[5-6][1-6][0-9].JPG
IMG_5510.JPG IMG_5526.JPG IMG_5542.JPG IMG_5558.JPG IMG_5614.JPG IMG_5630.JPG IMG_5646.JPG
IMG_5511.JPG IMG_5527.JPG IMG_5543.JPG IMG_5559.JPG IMG_5615.JPG IMG_5631.JPG IMG_5647.JPG
IMG_5512.JPG IMG_5528.JPG IMG_5544.JPG IMG_5560.JPG IMG_5616.JPG IMG_5632.JPG IMG_5648.JPG
IMG_5513.JPG IMG_5529.JPG IMG_5545.JPG IMG_5561.JPG IMG_5617.JPG IMG_5633.JPG IMG_5649.JPG
IMG_5514.JPG IMG_5530.JPG IMG_5546.JPG IMG_5562.JPG IMG_5618.JPG IMG_5634.JPG IMG_5650.JPG
IMG_5515.JPG IMG_5531.JPG IMG_5547.JPG IMG_5563.JPG IMG_5619.JPG IMG_5635.JPG IMG_5651.JPG
IMG_5516.JPG IMG_5532.JPG IMG_5548.JPG IMG_5564.JPG IMG_5620.JPG IMG_5636.JPG IMG_5652.JPG
IMG_5517.JPG IMG_5533.JPG IMG_5549.JPG IMG_5565.JPG IMG_5621.JPG IMG_5637.JPG IMG_5653.JPG
IMG_5518.JPG IMG_5534.JPG IMG_5550.JPG IMG_5566.JPG IMG_5622.JPG IMG_5638.JPG IMG_5654.JPG
IMG_5519.JPG IMG_5535.JPG IMG_5551.JPG IMG_5567.JPG IMG_5623.JPG IMG_5639.JPG IMG_5655.JPG
IMG_5520.JPG IMG_5536.JPG IMG_5552.JPG IMG_5568.JPG IMG_5624.JPG IMG_5640.JPG IMG_5656.JPG
IMG_5521.JPG IMG_5537.JPG IMG_5553.JPG IMG_5569.JPG IMG_5625.JPG IMG_5641.JPG IMG_5657.JPG
IMG_5522.JPG IMG_5538.JPG IMG_5554.JPG IMG_5610.JPG IMG_5626.JPG IMG_5642.JPG IMG_5658.JPG
IMG_5523.JPG IMG_5539.JPG IMG_5555.JPG IMG_5611.JPG IMG_5627.JPG IMG_5643.JPG IMG_5659.JPG
IMG_5524.JPG IMG_5540.JPG IMG_5556.JPG IMG_5612.JPG IMG_5628.JPG IMG_5644.JPG IMG_5660.JPG
IMG_5525.JPG IMG_5541.JPG IMG_5557.JPG IMG_5613.JPG IMG_5629.JPG IMG_5645.JPG IMG_5661.JPG

To view images, I use feh with -F -d options.
-F: display image in full screen
-d: display file name on top left corner.

Whenever I find a command use a lot if it uses options, I make a simple caller like below.
$ more iview

feh -F -d “$@”

To review above images in full screen mode, I run ‘$ iview IMG_5[5-6][1-6][0-9].JPG’

Above examples show how CLI becomes time-saving, effective computing platform over GUI (Graphic User Interface.) GUI is good for real-time interactive programs and general computer work. Handling few hundred files is fine.

Another exiting feature of gphoto2 is camera control. I haven’t test it on my Canon camera yet.

for ((i=0;i<240;i+=1)); do
gphoto2 –capture-image -F 1 -I 1 –filename ./$i.jpg
#Time between pictures
sleep 1m

About janpenguin

Email: k2.mountain [at] gmail [dot] com Every content on the blog is made by Free and Open Source Software in GNU/Linux.
This entry was posted in GNU/Linux and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s