Extract GPS data from JPEG using imago

Nowadays a lot of images contain GPS data. This data are useful in order to remember the exact position where a photo was taken. Those data are used by social networks to suggest you a location for your image.

GPS data can be very useful also during a digital investigation, because they can give you a lot of information about the place where the picture was shoot.

With imago  https://github.com/redaelli/imago-forensics (a python tool that I made) extracting GPS data from JPEG can be very easy and fast.

First of all you need to install imago as it is explained on the github page of the program, I suggest you to use pip.

Once imago is installed just run this command:

$ imago -i exif-samples/jpg/gps/ -g

Where:

-i is the flag for the input directory with jpeg images
-g is the flag for extracting GPS data

If you don’t have images with GPS data you can download them from the internet (just google it). For this example I used the images from exif-sample github repository.

After imago is launched you will see an output that show the progression of the extraction like the one in the image below:

Imago Gps Output
Imago running output

When imago will finish to extract data from the files you will find in the directory where you execute it a csv file (imago.csv) with all the information related to the images and to GPS.

The most important columns of the generated CSV file are Parsed_GPS_Latitude and Parsed_GPS_Longitude that are latitude and longitude expressed in degrees.

In the table below, created from imago.csv, there are the geo-coordinates extracted from the “exif-samples” github repository.

Filename GPS
Latitude
GPS
Longitude
DSCN0042.jpg 43.464455 11.8814783333
DSCN0027.jpg 43.4684416667 11.881515
DSCN0025.jpg 43.468365 11.881635
DSCN0010.jpg 43.4674483333 11.8851266667
DSCN0040.jpg 43.4660116666 11.8791116666
DSCN0012.jpg 43.4671566667 11.885395
DSCN0038.jpg 43.467255 11.8792133333
DSCN0021.jpg 43.4670816667 11.8845383333
DSCN0029.jpg 43.4682433333 11.8801716666

With these coordinates is simple to plot the points where the images were taken on a map, like in the example below.

Plot extracted GPS data on a map
Plot extracted GPS data on a map

Imago will also try to translate coordinates into readable information like city, nation, zip code… If this operation is possible you will also find in the generated CSV some other columns with this data.

For example for the image DSCN0021.jpg is possible to retrieve these additional information:

  • city: Arezzo
  • residential: Arezzo
  • county: AR
  • suburb: La Torre
  • state: Tos
  • postcode: 52100
  • country_code: it
  • country: Italia
  • pedestrian: Piazza del Duomo
  • place_of_worship: Duomo di Arezzo

Please write in the comment if you have any questions regarding imago or GPS data extraction.

Leave a Reply

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