Add EXIF Metadata to Photos with a Bash One-Liner

If you need to write EXIF data to multiple photos, a simple yet efficient Bash shell script might be a better tool for the job than the all-mighty digiKam. The script consists of a command, and it uses the excellent ExifTool utility to write specific EXIF values to photos. To install ExifTool on Debian and Ubuntu, run the following command as root:

apt-get install libimage-exiftool-perl

Create then a new text file and paste the following code into it:

#!/bin/bash
exiftool -make="$1" -model="$2" -fnumber=$3 -exposuretime=$4 -iso=$5 $6

Save the file under the exifwrite.sh name, and make the script executable using the chmod +x exifwrite.sh command. To write EXIF data to a photo, run the ./exifwrite.sh command followed by the required values:

./exifwrite.sh 'Nippon Kogaku K.K.' 'Nikon EM' 11 1/125 400 foo.jpg

The script lets you add maker, model, aperture, shutter speed and ISO to a photo, but you can easily tweak it to include other EXIF entries.

Freelance tech writer covering Linux and open source software

Tagged with: , ,
Posted in Open Source, Photography, Software
Follow

Get every new post delivered to your Inbox.

Join 185 other followers

%d bloggers like this: