Trying to stamp images with exiftool

Started by davidcalvin, August 01, 2013, 09:21:51 PM

Previous topic - Next topic

davidcalvin


Hello,

I am relatively new to exiftool. I need to stamp a series of images with GPS locations. I am following the directions that invole issuing:

xiftool -r -p gpx.fmt  IMG_0019.JPG > out.gpx

IMG_0019.JPG has GPS data. I am assuming that the above command will create a track file for me. I then use the outputted out.gpx file to stamp a non tagged image like this:

exiftool -p -geotag out.gpx /Users/me/Pictures/LBReplicateCache/

And I get:

    1 directories scanned
    0 image files updated
    5 image files unchanged

I have also tried the command this way:

exiftool -geotag=out.gpx /Users/me/Pictures/LBReplicateCache/

With the same result. The .gpx file seems to have valid lat and longitude data in it. I am wondering if there is an issue with the file. Here is what the first command created:

<?xml version="1.0" encoding="utf-8"?>
<gpx version="1.0"
creator="ExifTool 9.33"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<trk>
<number>1</number>
<trkseg>
<trkpt lat="25.0361666666667" lon="121.519">
  <ele>16.27441406</ele>
</trkpt>
</trkseg>
</trk>
</gpx>

Does that look valid? Man.. I am totally stuck. Any help would be thoroughly appreciated. I tried doing a search on the forum and came up empty.

Thanks,

David

Phil Harvey

Hi David,

If you read the documentation in out.gpx, the correct command is:

exiftool -p gpx.fmt -d %Y-%m-%dT%H:%M:%SZ FILE [...] > out.gpx

The problem is that you weren't formatting the timestamps correctly.

If it doesn't work after this, it is because the times between the two images are too far apart.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

davidcalvin

Hi Phil,

Thanks for  the response. I will give that a try.

Is it necessary for time  stamps to be involved in order to stamp an image with GPS data?

Thanks,

David

davidcalvin

And, BTW, I did try that syntax. I got the impression that the timestamp was not necessary due to this from the docs:


This example assumes that the GPSLatitude, GPSLongitude, GPSAltitude and GPSDateTime tags are all available in each processed FILE. Warnings will be generated for missing tags. The output GPX format will invalid if any GPSLatitude or GPSLongitude tags are missing, but will be OK for missing GPSAltitude or GPSDateTime tags.

David

Phil Harvey

Hi David,

Yes, the times must be in order.  Use the -fileorder option with the appropriate tag name to achieve this.
The output GPX will be valid with a missing time stamp, but it can't be used for geotagging without a valid timestamp.  Without a timestamp you have a waypoint log, not a temporal track log.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

davidcalvin

So when I issue

exiftool -fileOrder gpsdatetime -r -p gpx.fmt -d 2013-12-01T12:00:00Z IMG.jpg > out.gpx

I get:

Warning [Minor] 'gpsdatetime' not defined - IMG.jpg

Is this because the source file is missing the gpsdatetime info? Or is my invocation incorrect?

Thanks,

David

Phil Harvey

The file is missing the GPS date and/or time.  What is the output of:

exiftool -gps:all -a IMG.jpg

?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

davidcalvin

The output for the file I am trying to get a track file for is:

GPS Latitude Ref                : North
GPS Latitude                    : 25 deg 2' 10.20"
GPS Longitude Ref               : East
GPS Longitude                   : 121 deg 31' 8.40"
GPS Altitude Ref                : Above Sea Level
GPS Altitude                    : 16.27441406 m
GPS Time Stamp                  : 02:20:38.77
GPS Img Direction Ref           : True North
GPS Img Direction               : 211.4742268

I have tried all combinations of the suggested commands and I get the warning for the missing time stamp. It appears to have one. I notice that the .fmt seems to be missing some of the tags that are in the photo. Would that matter?

Thanks,

David

Phil Harvey

You get a warning for a missing "gpsdatetime", not a missing "time stamp".

Both GPSTimeStamp and GPSDateStamp are necessary for the Composite GPSDateTime tag.  Without a date and time, the output GPX log will have no temporal information.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

davidcalvin


Hi Phil,

I get:

Warning: [Minor] Tag 'gpsdatetime' not defined - IMG.jpg'

So it sounds like I am missing the GPS date stamp. Is there a way to force the image to have this information? Or to fake it? If I import the photo into iPhoto I can reposition the image anywhere in the world I want to. I am trying to do this work from the command line. Is there a way to brute force this?

Thanks again,

David

Phil Harvey

Hi David,

You can fill in the GPSDateStamp from any other date/time tag like this:

exiftool "-gpsdatestamp<datetimeoriginal" FILE

Which should work OK except when you are within your time zone of midnight.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

davidcalvin

Thanks for the help Phil,

So with that last suggestion, I can get a clean track file created. When I try to use that track file to apply geotag info to an image that has no geo tag info using:

exiftool -geotag out.gpx BoraBora\ 36.jpg

I get:

Warning: No track points found in GPS file 'out.gpx' in File:Geotag (ValueConvInv)
Warning: GPS track is empty in File:Geotime (ValueConvInv) - BoraBora 36.jpg
Warning: No writable tags set from BoraBora 36.jpg
    0 image files updated
    1 image files unchanged

The track file does appear to have a track point (lat, long, gps time, etc). The values for the gps info after correcting the gps date stamp are these:

GPS Latitude Ref                : North
GPS Latitude                    : 25 deg 2' 10.20"
GPS Longitude Ref               : East
GPS Longitude                   : 121 deg 31' 8.40"
GPS Altitude Ref                : Above Sea Level
GPS Altitude                    : 16.27441406 m
GPS Time Stamp                  : 02:20:38.77
GPS Img Direction Ref           : True North
GPS Img Direction               : 211.4742268
GPS Date Stamp                  : 2012:09:30

So it seems that all is well. Is it choking because the values don't make sense?

Thanks for all the help,

David

davidcalvin

This is the newly created track file:


<?xml version="1.0" encoding="utf-8"?>
<gpx version="1.0"
creator="ExifTool 9.33"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<trk>
<number>1</number>
<trkseg>
<trkpt lat="25.0361666666667" lon="121.519">
  <ele>16.27441406</ele>
  <time>2009-01-01</time>
</trkpt>
</trkseg>
</trk>
</gpx>

Phil Harvey

Why is there no time in the GPX file?  There is only a date.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

davidcalvin

I was wondering the same thing. The file contains this gps data (from which I am making gpx file). I tried to recreate the gpx file and now I am getting the below gpx data. I have noticed that, whenever I make a change to a file using exiftool I must touch the file for the file system to realize the change. Not sure why that is.

<?xml version="1.0" encoding="utf-8"?>
<gpx version="1.0"
creator="ExifTool 9.33"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<trk>
<number>1</number>
<trkseg>
<trkpt lat="25.0361666666667" lon="121.519">
  <ele>16.27441406</ele>
  <time>2012:09:30 02:20:38.77Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>

When I apply that GPX file to an untagged image I get:

Argument "-Geotime<DateTimeOriginal" is assumed
Loaded 0 points from GPS track log file 'out.gpx'
Warning: No track points found in GPS file 'out.gpx' in File:Geotag (ValueConvInv)
======== BoraBora 36.jpg
Setting new values from BoraBora 36.jpg
Warning: GPS track is empty in File:Geotime (ValueConvInv) - BoraBora 36.jpg
Warning: No writable tags set from BoraBora 36.jpg
Nothing changed in BoraBora 36.jpg
    0 image files updated
    1 image files unchanged

So.. the track file looks good to me. Yet its saying 0 track points loaded. I downloaded a track file from the internet for some place un Utah and, at least that track file says its loading points, but it still fails to apply the gps data to the image. Does the creation date of the photo need to be near to the gps date time stamp of the photo? Or is there something else going on?

Thanks,

David