Command-line Photographic Workflow on Linux

Most Linux photographers use graphical applications like digiKam, Rawstudio, or darktable as their tools of choice for processing and managing photos. But it is possible to set up a photographic workflow built around command-line tools that can handle a wide range of photographic tasks: from fetching photos from your camera and convert RAW files to the JPG format, to backing up the photos on a remote machine and even publishing them on the web. Here is a sample workflow you can use as your starting point.

The first order of business is to set up a dedicated working directory for storing photos transferred from your camera:

mkdir ~/fotki

Next, make sure that the gPhoto software is installed on your system. gPhoto is available in the software repositories of many popular LInux distributions, so you can install it using your distro’s package manager. On Ubuntu, this can be done using the sudo apt-get install gphoto2 command. Connect then the camera to your machine and run the gphoto2 –auto-detect command. If your camera is supported, the command should return brief camera info.

To transfer photos from the camera to the fotki directory, run the following commands in the terminal:

cd ~/fotki
gphoto2 --get-all-files

If your camera supports tethered shooting, you can use gphoto2 to automatically transfer photos from the camera as soon as you take them. To do this, use the gphoto2 –capture-tethered command.

Once the photos have been transferred, you might want to change their names to something more descriptive. One way to do this is to use the exiftool utility (on Ubuntu, you can install it using the sudo apt-get install libimage-exiftool-perl command). For example, the following command renames Nikon RAW files using date info from EXIF metadata:

exiftool -d %Y%m%d/%Y%m%d-%H%M%S.%%e "-FileName<DateTimeOriginal" *.NEF

If you shoot in RAW, the UFRaw utility can come in handy when you need to convert RAW files to the JPEG format. To install it on Ubuntu, run the sudo apt-get install ufraw command. Use then the ufraw-batch tool to convert RAW files:

ufraw-batch --out-type=jpeg *.NEF

The command above uses the default options for converting RAW files, and to get the best result, you might want to tweak them. For a full list of supported options, run the man ufraw-batch command. Here is an example of a more advanced ufraw-batch command:

ufraw-batch --wb=camera --rotate=camera --out-type=jpeg --out-path=jpeg/ nef/*.NEF

The good old rsync utility can take care of backing up your photos to a local destination, external storage device, or a remote server. For example, the following command backs up the fotki directory to a server on the local network using a secure SSH connection:

rsync -avhe ssh --delete ~/fotki user@remotehost:/home/user/fotki

Finally, if you want to publish your photos on the web, the llgal tool got you covered. It can generate no-frills static HTML galleries. As any command-line tool worth its salt, llgal supports a handful of options for you to tweak. The -R option, for example, can be useful if you want llgal to include subdirectories into the final gallery. To give the gallery a name, use the –title option as follows: –title “Garden Flowers.” llgal doesn’t generate thumbnails, so if the source directory contains large image files, it’s a good idea to limit their width and height to a specific size. This can be done using the –sx and –-sy options. And you can use the –exif option to display EXIF metadata for each photo. To sum up, here is an example:

llgal --exif --li -L -R --title "Garden Flowers" --sx 800 --sy 600

To see a list of all available options supported by llgal, run the llgal –help command.

These are just a handful of tools you can use to set up a command-line photographic workflow on Linux. There are, of course, many other handy command-line tools out there you can incorporate into your workflow. Using, for example, the HDR script, you can automate the process of creating HDR images, while the Enfuse tool (it’s part of the Hugin software) can be used for focus stacking.

Tech writer covering Linux and open source software

Tagged with: , , , ,
Posted in Open Source, Photography, Software
3 comments on “Command-line Photographic Workflow on Linux
  1. Phil Hill says:

    I note you suggest UFRaw as a potential app for converting Nikon RAW files and it made me think that a possibly interesting article would be a comparison of just what kind of a job each of the available command line RAW utilities does if utilised with the default settings. I have noticed that there really are considerable differences between the output of different apps and so it would probably be interesting to many others and of course any advice you can offer on best possible tweaks would always be most welcome. Thanks again Dmitri for a very interesting article today.

    Regards… Phil

  2. notbob says:

    Jes that one gphoto2 dwnld tip was worth the whole article. I usta hafta load digikam and all its required libs on my Slackware box and even then it was iffy for digicam to see my ancient Powershot camera if I didn’t use the the proper incantations and sacrifice a couple chickens. I finally jes skipped the whole mess and bought a USB card reader. Now, Slackware has seen fit to include gphoto2 in its newer versions and that get-all-files command worked flawlessly. You are now on my shortlist of photo bookmarks.

  3. Thanks for linking to my HDR script :)
    I plan on upgrading it to use dcraw instead of UFRaw to have more control over the development options.

Comments are closed.

Recipes for automated and streamlined photographic workflow on Linux

Curve presets for digiKam and the GIMP

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: