Read Exif data
exiv2 /path/to/image.jpg
Write/modify Exif data in images
the exiv2 tool can be used to manipulate image meta-data
like exif-tags and so on…
In this example I will put Geo-Tags into a JPEG.
1st of all i looked up the correct values for my object.
go to google-maps or openstreetmap.org. both are ok…
Click the loction you are looking for and get the coordinates like 50.364134,7.605638 (Latitude,Longitude)
To use that data in exif-tags you will have to convert it to »DEG° MIN’ SEC”«
I used this converter to do this.
Latitude: 50.364134 --> 50° 21' 50''
Longitude: 7.605638 --> 7° 36' 20''
Simply put exiv2-commands into a file:
set Exif.Image.Copyright (c) Thor himself
set Exif.Photo.UserComment webmaster@schnallich.net
set Exif.GPSInfo.GPSLatitude 50/1 21/1 50/1
set Exif.GPSInfo.GPSLatitudeRef N
set Exif.GPSInfo.GPSLongitude 7/1 36/1 20/1
set Exif.GPSInfo.GPSLongitudeRef E
exiv2 expects ‘rational number’ for DEG, MIN and SEC so, we devide all these values by 1 (e.g. 50/1 … a.s.o.)
In case of Germany, we are north of equator which means GPSLatitudeRef must be N
and we are east of greenwich meridian which means GPSLongitudeRef must be E
Now call exiv2
exiv2 -m ./exiv2-data.txt /path/to/image.jpg
Here is an example of using exiv2 without commandfile:
exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \
-M"set Exif.GPSInfo.GPSLatitudeRef N" \
-M"..." image.jpg