Get the images from your camera with either standard USB storage device support or gphoto.
So you have a digital camera full of pictures, and you have a Linux machine with the GIMP raring to go, but you need to get the pictures from the camera to the computer under Linux. As this hack illustrates, using your digital camera under Linux is not much of a headache, particularly with newer distributions and newer cameras.
Although there are many ways to categorize digital cameras, when it comes to using them under Linux there are only two categories: cameras that act as USB storage devices and cameras that don’t. Generally, newer cameras act like USB storage devices (such as a USB thumb drive) when plugged into a computer, but many older cameras use proprietary communication standards even though they use standard USBs or serial ports. The easiest way to tell which type of camera you have is to plug it into a non-Linux system. If it shows up as a regular hard drive, under Linux you can treat it like a USB storage device. Otherwise you may have to go the gtkam route, which I describe later, in the section, “Non-USB Storage Devices.”
Most modern desktop Linux distributions offer automatic management of USB storage devices—just plug in a USB key or other device, and KDE or Gnome will automatically create a new icon on your desktop that you can click to access the device. If you have such a distribution, then using your digital camera is easy: plug in the camera, click on the icon that appears on the desktop, and browse it like you would any other hard drive. You can copy and paste images to your desktop or another folder, and when you are done you can close the window, right-click on the icon, unmount the camera, and unplug it.
If you don’t have such a desktop environment, it still isn’t too
difficult—you just have to go through an extra step or two. In order
to mount your camera, you need to determine which SCSI drive Linux has
assigned it. To do this, run tail
on your /var/log/syslog or
/var/log/messages log file as root,
and then plug in the device. You
should see output something like this:
# tail -f /var/log/messages
Jul 19 20:44:36 moses kernel: SCSI device sda: 58605120 512-byte hdwr
sectors (30006 MB)
Jul 19 20:44:36 moses scsi.agent[30251]: sd_mod: loaded sucessfully
(for disk)
Jul 19 20:44:36 moses kernel: /dev/scsi/host0/bus0/target0/lun0: p1
Jul 19 20:44:36 moses kernel: Attached scsi disk sda at scsi0, channel 0, id
0, lun 0
Jul 19 20:49:16 moses kernel: usb 4-1: USB disconnect, address 4
Jul 19 21:03:26 moses -- MARK --
Jul 19 21:23:26 moses -- MARK --
Jul 19 21:35:19 moses kernel: usb 1-1: new full speed USB device using uhci_
hcd and address 3
Jul 19 21:35:19 moses kernel: scsi1 : SCSI emulation for USB Mass Storage
devices
Jul 19 21:35:22 moses usb.agent[4679]: usb-storage: already loaded
In the output you can see that Linux assigned my digital camera the sda device in this line:
Jul 19 20:44:36 moses kernel: SCSI device sda: 58605120 512-byte hdwr sectors (30006 MB)
To access the files on the camera, I become root
, create a mount point under
/mnt, and then use the mount
command to access it:
# mkdir
/mnt/camera
# mount -t vfat
/dev/sda1 /mnt/camera
Now I can browse to /mnt/camera either in
the terminal or with a file manager and copy files from the camera. I
specified a filesystem type of vfat
because almost all digital camera media (indeed all flash media) are
formatted as vfat
. When I’m
finished, I unmount the drive and unplug it:
# umount
/dev/sda1
Not all digital cameras operate as generic USB storage devices, even if they have a USB port. This is particularly true of older digital cameras. To use one of these cameras you must use gtkam, digiKam, gphoto2, or another program that uses the libgphoto libraries to provide basic access to the files on your digital camera.
Most major desktop distributions have packages for gtkam and libgphoto so you can use your standard packaging tool to install them. Otherwise download the source from the official gtkam page at http://www.gphoto.org/proj/gtkam and compile it according to the installation instructions.
Before you run gtkam, connect the camera to
the computer by the USB or serial port. Then start
gtkam through your application menu or type
gtkam
in a terminal. The main
window appears fairly blank by default, and the first step is to click
Camera → Add Camera to open a dialog that displays the full list of
cameras gtkam supports.
Click Detect for gtkam to probe the USB ports for your camera, or select it from the list of camera models and click OK. You are dropped back to the main window that then presents you with thumbnails of all your photos. gtkam doesn’t provide a lot of photo-editing features; basically you can zoom in and out on your photos and select some or all to save for later editing. Once you are finished, be sure to close gtkam before you unplug your digital camera from the computer.
Get Linux Multimedia Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.