Most image file types can contain extensive metadata. This information can describe parameters like geolocation of the photograph, description, keywords, etc.
The Exif metadata embedded by a digital camera at the time of the capture can be altered and expanded using any number of free or non-free Exif and XMP editors.
Exiftool is a free OS independent command line based editor specifically suited for high volume and automated batch metadata editing. Exiftool is highly scriptable using Bash, Batch, Python or whatever the tool of your choice may be.
I wrote a Linux Bash script for a project where thousands of scanned photographs needed to be augmented with new metadata. Some information was image specific and required user entry like geolocation, description, searchable keywords and the year picture was taken. Other information was hard coded into the script because it was specific to the set like the name of the locale and the country of origin ISO code.
The script is essentially a one-liner command:
#!/bin/bash echo "Modifying image "$1 echo "Enter latitude" read latitude echo "Enter longitude" read longitude echo "Enter elevation" read elevation echo "Enter description" read description echo "Enter comma separated keywords" read keywords echo "Enter year" read year exiftool \ -Description="$description" \ -Subject="$keywords" \ -PersonInImage="$description" \ -ImageDescription="$description" \ -Caption-Abstract="$description" \ -DateCreated="$year:01:01" \ -GPSLongitudeRef=E \ -GPSLongitude=$longitude \ -GPSLatitudeRef=N \ -GPSLatitude=$latitude \ -GPSAltitude=$elevation \ -GPSAltituderef="Above Sea Level" \ -City="Sarajevo" \ -Country="Bosnia and Herzegovina" \ -CountryCode="3166-2:BA" \ $1
You can use the script from the command line, or you can drag-and-drop pictures onto it (this procedure varies in different Linux distros, we’ll go over the use in Ubuntu).
- Install Exiftool from the command line: sudo apt-get install libimage-exiftool-perl
- Copy and paste the script into a text editor, change the parameters to suit your needs and save as exifmod.
- Right click the script and enable executable privileges in the file properties or execute chmod +x exifmod from the command line.
- Create an application launcher and point it to the location of the script. In case of exifmod saved on your desktop this would be /home/yourusername/Desktop/exifmod.
- Enable executable privileges for the launcher file as well.
Drag and drop an image onto the launcher. Follow the prompts in the pop-up console window. Skip properties by leaving the answers blank and pressing enter. You can obtain the longitude and latitude of the photo location from Google Maps.
To verify the embedded metadata from the command line use: exiftool -All sampleimage.jpg.