Guide to GPS Metadata in Photos (Part 1): Programs for manipulating metainformation in images
Table of Contents: Guide to GPS Metadata in Photos
1. Programs for manipulating metainformation in images
1.1 How to install ExifTool on Windows and Linux
1.2 How to install Exiv2 on Windows and Linux
1.3 How to install Geotag on Windows and Linux
2. How to understand, extract and convert geographic coordinates
3. How to spoof GPS and other metadata in photos
4. How to build motion tracks based on a group of photos
This is the beginning of a series of four articles devoted to GPS coordinates in images – reading them, selectively deleting, spoofing and building tracks based on a series of images. These methods can be applied not only to GPS tags, but also to any other metadata, both in photographs and in any other files.
But before we start, we need to prepare our working environment – we need to install the programs that we will be using in these articles. The software installation is shown for Windows and Linux – regardless of your operating system, you will be able to manipulate metainformation.
How to install ExifTool on Windows and Linux
ExifTool is a very powerful command line application for reading, writing and editing metainformation in a wide variety of files. ExifTool supports many different metadata formats including EXIF, GPS, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP and ID3, Lyrics3, and many digital camera manufacturer's notes Canon, Casio, DJI, FLIR, FujiFilm , GE, GoPro, HP, JVC/Victor, Kodak, Leaf, Minolta/Konica-Minolta, Motorola, Nikon, Nintendo, Olympus/Epson, Panasonic/Leica, Pentax/Asahi, Phase One, Reconyx, Ricoh, Samsung, Sanyo, Sigma/Foveon and Sony.
Installation ExifTool on Debian, Linux Mint, Kali Linux, Ubuntu and their derivatives
sudo apt update sudo apt install libimage-exiftool-perl
Installation ExifTool on Arch Linux, Manjaro, BlackArch
sudo pacman -S perl-image-exiftool
After that, the executable file of the program is located in the path /usr/bin/vendor_perl/exiftool. Since the file is not in the $PATH environment variable, to run it you need to specify the full path to the file:
/usr/bin/vendor_perl/exiftool
This can be fixed by linking to the file from the directory included in $PATH, for example, from /usr/bin/:
sudo ln -s /usr/bin/vendor_perl/exiftool /usr/bin/
After that, the program can be run like this:
exiftool
Installation ExifTool on Windows
Go to the official website of the program: https://exiftool.org/ and download the “Windows Executable” archive.
Unpack the downloaded exiftool(-k).exe file.
Double-clicking this file will display the ExifTool documentation (in English).
The filename exiftool(-k).exe indicates that the program is started with the -k option. Because of the use of parentheses in the file name, when you run the program on the command line, you have to put it in quotes every time. To avoid this, rename the file to exiftool.exe.
To fully work with the program, you need to run it on the command line. If you do not know what this is, then read the article “How to set up the PowerShell environment on Windows and Linux”.
An example of extracting metadata on Windows:
1. Let's open PowerShell – for this press Win+x and select “Windows PowerShell”.
2. Suppose the exiftool.exe file is located in the C:\Users\MiAl\Downloads\ folder, go to it using the cd command:
cd C:\Users\MiAl\Downloads\
3. To extract metadata from an image, run a command like this:
.\exiftool.exe 'C:\PATH\TO\PICTURE.jpg'
For example, an image file with metadata is located at the path C:\Users\MiAl\Documents\testing\foto\20191106_181909.jpg, then the command for extracting metadata from it is as follows:
.\exiftool.exe 'C:\Users\MiAl\Documents\testing\foto\20191106_181909.jpg'
How to install Exiv2 on Windows and Linux
Exiv2 is a cross-platform command line utility for managing image metadata. It provides fast and easy read/write access to Exif, IPTC and XMP metadata and ICC profile embedded in digital images in various formats. Exiv2 is available as free software and is used in many projects including KDE and Gnome Desktops, as well as many applications including GIMP, darktable, shotwell, GwenView, and Luminance HDR.
Installation Exiv2 on Debian, Linux Mint, Ubuntu and their derivatives
To install, just run the commands:
sudo apt update sudo apt install exiv2
Installation Exiv2 on Arch Linux, Manjaro, BlackArch
sudo pacman -S exiv2
Installation on Windows
Go to the official website of the program: https://exiv2.org/download.html and download the archive “exiv2-*msvc64.zip”.
Unpack the downloaded archive.
For simplicity, rename the folder, for example, “exiv2-0.27.3-2019msvc64” to “exiv2”.
The executable files are located in the bin folder.
To work with the program, you need to run it on the command line. If you do not know what this is, then read the article “How to set up the PowerShell environment on Windows and Linux”.
Example of extracting metadata on Windows
1. Let's open PowerShell – for this press Win+x and select “Windows PowerShell”.
2. Suppose the exiv2.exe file is located in the C:\Users\MiAl\Downloads\exiv2\bin\ folder, go to it using the cd command:
cd C:\Users\MiAl\Downloads\exiv2\bin\
3. To extract metadata from an image, run a command like this:
.\exiv2.exe 'C:\PATH\TO\PICTURE.jpg'
For example, an image file with metadata is located at the path C:\Users\MiAl\Documents\testing\foto\20191106_181909.jpg, then the commands for extracting metadata from it are as follows:
.\exiv2.exe 'C:\Users\MiAl\Documents\testing\foto\20191106_181909.jpg'
The .exe extension шы optional:
.\exiv2 -p a 'C:\Users\MiAl\Documents\testing\foto\20191106_181909.jpg'
.\exiv2 -p v -g GPS 'C:\Users\MiAl\Documents\testing\foto\20191106_181909.jpg'
How to install Geotag on Windows and Linux
Geotag is an open source program that allows you to do the following with images (for one photo, selected photos, or all of them):
- change of metadata (coordinates, date and time of shooting, comment)
- to show on the map
- show on map with direction
- show on Google Earth
- search for places
- copy location, including between shots
- search for place names
- altitude search
Installation Geotag on Kali Linux, Debian, Linux Mint, Ubuntu and their derivatives
Start by installing Java (JDK) on Windows and Linux.
Then download the two files with the following commands:
curl -L --output geotag.jar 'https://sourceforge.net/projects/geotag/files/latest/download' wget -O jaxb-api.jar 'https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar'
Run like this:
java -Xmx256M -classpath "jaxb-api.jar:geotag.jar" org.fibs.geotag.Geotag
256M is the amount of RAM allocated to the program, you can increase this value.
Be sure to install ExifTool, otherwise the program will not be able to work with GPS coordinates:
sudo apt install libimage-exiftool-perl
Install optional dependencies if you like:
sudo apt install gpsbabel dcraw
Also a dependency is Google Earth, if you want, install it:
ver=`curl -sL https://dl.google.com/linux/earth/deb/dists/stable/main/binary-amd64/Packages | grep -Pom1 'Version: \K[^-]*'`; wget -O google-earth-pro.deb "https://dl.google.com/linux/earth/deb/pool/main/g/google-earth-pro-stable/google-earth-pro-stable_$ver-r0_amd64.deb" sudo apt install ./google-earth-pro.deb curl -s https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/earth.gpg --import sudo chmod 644 /etc/apt/trusted.gpg.d/earth.gpg
You will now find Google Earth in the menu:
If you prefer the command line, then you can run the program like this:
/opt/google/earth/pro/googleearth-bin
After that, in Geotag go to File → Options → External Programs → Google Earth → Google Earth Path and specify the path to the executable file: /opt/google/earth/pro/googleearth-bin
Installation Geotag on Arch Linux, Manjaro, BlackArch
sudo pacman -S geotag gpsbabel dcraw
At startup, the program will report that ExifTool was not found.
You can specify the path to this tool in the program settings.
Specify the path to the file: /usr/bin/vendor_perl/exiftool
Or you can simply create a symbolic link for the program to find it:
sudo ln -s /usr/bin/vendor_perl/exiftool /usr/bin/
Installation on Windows
Start by installing Java (JDK) on Windows and Linux.
Then download two files:
https://sourceforge.net/projects/geotag/files/latest/download https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar
The program must be run from the command line. If you are not familiar with it, see the article “How to set up the PowerShell environment on Windows and Linux”.
In the command line, go to the program folder, for example (path to the folder with the downloaded files C:\Users\MiAl\Downloads\):
cd C:\Users\MiAl\Downloads\
Run the following command:
java -Xmx256M -classpath ".\jaxb-api-2.3.1.jar;.\geotag-0.103.jar" org.fibs.geotag.Geotag
It is not necessary to go to the folder with the program, you can specify the full path to the location of the two downloaded files in the command:
java -Xmx256M -classpath "C:\Users\MiAl\Downloads\jaxb-api-2.3.1.jar;C:\Users\MiAl\Downloads\geotag-0.103.jar" org.fibs.geotag.Geotag
Be sure to install ExifTool, as important program functions depend on it. On this page find the “Installation ExifTool on Windows” section.
After that, in Geotag go to File → Options → External Programs → Exiftool → Exiftool Path and specify the path to the ExifTool executable file.
Optionally, you can install Google Earth Pro. This program is an optional dependency for Geotag.