I have an image captured using a camera attached to a drone. The camera I used does not give me any GPS data, however my drone has an in-built GPS which I can use to get the location at which the image was captured. I save this information in a text file. How do I add this latitude and longitude saved in the text file to the image? I am writing my code in python. So far I have only found information about using csv or gpx files with exiftool but nothing about text files.
Asked
Active
Viewed 769 times
1 Answers
2
import exiftool
et = exiftool.ExifTool("C:\Users\...\exiftool.exe")
et.execute("-GPSLongitude=10.0", "picture.jpg")
et.execute("-GPSLatitude=5.78", "picture.jpg")
et.execute("-GPSAltitude=100", "picture.jpg")
et.terminate()
And without terminate() statement
with exiftool.ExifTool("C:\Users\...\exiftool.exe") as et:
et.execute("-GPSLongitude=10.0", "picture.jpg")
et.execute("-GPSLatitude=5.78", "picture.jpg")
et.execute("-GPSAltitude=100", "picture.jpg")
Also as the user @StarGeek said
You also have to set the GPSLatitudeRef and GPSLongitudeRef values, especially if the value is in the western or southern hemisphere. It can be done the same way et.execute("-GPSLongitudeRef=10.0", "picture.jpg") – StarGeek

Iakovos Belonias
- 1,217
- 9
- 25
-
1You also have to set the `GPSLatitudeRef` and `GPSLongitudeRef` values, especially if the value is in the western or southern hemisphere. It can be done the same way `et.execute("-GPSLongitudeRef=10.0", "picture.jpg")` – StarGeek Mar 23 '19 at 15:40