Photo Metadata Editing

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:

exifmod bash script
  1. #!/bin/bash
  2. echo "Modifying image "$1
  3. echo "Enter latitude"
  4. read latitude
  5. echo "Enter longitude"
  6. read longitude
  7. echo "Enter elevation"
  8. read elevation
  9. echo "Enter description"
  10. read description
  11. echo "Enter comma separated keywords"
  12. read keywords
  13. echo "Enter year"
  14. read year
  15. exiftool \
  16. -Description="$description" \
  17. -Subject="$keywords" \
  18. -PersonInImage="$description" \
  19. -ImageDescription="$description" \
  20. -Caption-Abstract="$description" \
  21. -DateCreated="$year:01:01" \
  22. -GPSLongitudeRef=E \
  23. -GPSLongitude=$longitude \
  24. -GPSLatitudeRef=N \
  25. -GPSLatitude=$latitude \
  26. -GPSAltitude=$elevation \
  27. -GPSAltituderef="Above Sea Level" \
  28. -City="Sarajevo" \
  29. -Country="Bosnia and Herzegovina" \
  30. -CountryCode="3166-2:BA" \
  31. $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).


  1. Install Exiftool from the command line: sudo apt-get install libimage-exiftool-perl
  2. Copy and paste the script into a text editor, change the parameters to suit your needs and save as exifmod.
  3. Right click the script and enable executable privileges in the file properties or execute chmod +x exifmod from the command line.
  4. 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.
  5. 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.



Leave a Reply

Your email address will not be published. Required fields are marked *