Posts Tagged ‘CLI’
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:
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:
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.