Status

Location
London, England
Subscribe to GeoRSS Subscribe to KML


Exiftool is easy to use

Published in Geolocation, Linux, Programming  |  7 Comments


Exiftool is a very easy to use, complete, command-line interface to image EXIF data. It also (and especially) works with GPS data and tiff files.

For instance, to view the filename, size and latitude of an image:
exiftool -filename -imagesize -gps:GPSLatitude IMGP0737.tif

To set the new latitude of an image:
exiftool -gps:GPSLatitude=”52 deg 47′ 22.5894″ IMGP0737.tif

I read the Exif 2.2 spec (ya know, light reading), and realized that I was formatting the GPS info tag incorrectly. Exiftool formats the correct version to look pretty (and as above). However, the official spec states that the latitude and longitude info should be dd,mm,ss or dd,mmmm and then the North/South and East/West specified in the GPSLatitudeRef and GPSLongitudeRef as N/S, or E/W. Therefore, the correct format is:

exiftool -GPSMapDatum="WGS-84" -gps:GPSLatitude="34,57,57" -gps:GPSLatitudeRef="N" -gps:GPSLongitude="83,17,59" -gps:GPSLongitudeRef="W" -gps:GPSAltitudeRef="0" -GPSAltitude=1426 -gps:GPSMeasureMode=2 -City="RabunBald" -State="North Carolina" -Country="USA" ~/Desktop/RabunBaldSummit_NC.jpg

Similar Posts


Responses

  1. Phil Harvey says:

    March 4th, 2005 at 9:08 am (#)

    The GPS lat/long information is stored in binary format as in the EXIF information. Whether you use commas or anything else to separate the degree/minutes/seconds makes no difference, since they are all removed before the binary values are written to file. ExifTool is very flexible about the input formats, so your first example will have produced identical EXIF information as if you had used commas.

    True though, you should specify a lat/long ref (N or S/E or W) when specifying lat/long.

  2. Russell Nelson says:

    April 23rd, 2005 at 6:33 pm (#)

    Hmmm…. For whatever reason, it looks like the lat/lon needs to be specified as ss,mm,dd, not dd,mm,ss as you wrote.
    -russ

  3. Andrew says:

    April 24th, 2005 at 4:24 pm (#)

    This isn’t the case in my experience. I have successfully written the Latitude/Longitude as dd,mm,ss.ss. However, the GPSAltitudeRef doesn’t work for writing. It appears there wasn’t a suitable conversion function written in the perl code.

  4. Phil Harvey says:

    September 14th, 2006 at 2:13 pm (#)

    The GPSAltitudeRef problem is one of the ExifTool FAQ’s. You need to use the -n option to set it numerically, or use the proper string:

    exiftool -n gpsaltituderef=0 image.jpg

    or

    exiftool “gpsaltituderef=above sea level” image.jpg

  5. Phil Harvey says:

    September 14th, 2006 at 2:18 pm (#)

    Ooops. Forgot the “-” before “gpsaltituderef” in the examples above, but you get the idea…

  6. qvfwzkuwrt says:

    July 2nd, 2007 at 8:43 am (#)

    Hello! Good Site! Thanks you! ghaviwqqkzhol

  7. adino says:

    April 28th, 2008 at 8:25 am (#)

    One must specify format in DD.MMMMM instead of DD,MMMMM as you write in the post. I just tested it, and if I used comma as decimal point separator it returned strange results.

Leave a Response