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:

exiftool -make="$1" -model="$2" -fnumber=$3 -exposuretime=$4 -iso=$5 $6

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

./ '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.

Tech writer covering Linux and open source software

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

Recipes for automated and streamlined photographic workflow on Linux

Use digiKam? Get this book!

Practical advice for nighttime photography

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

%d bloggers like this: