Trying to stamp images with exiftool

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

Previous topic - Next topic

Phil Harvey

Hi David,

We're back to the first problem.  Improper date/time formatting in the GPX file.  It should be "2012:09:30T02:20:38.77Z" (the "T" is necessary).

- 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


That's interesting. So the date that is actually in the gpx file needs to be that? Does that mean that the gpx template file on the web site has the wrong format since it created that output?

I will try tweaking the gpx file.

David

davidcalvin

Tweaked the GPX file. Still not working, same error. Here is the update:


<?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:30T02:20:38.77Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>

Phil Harvey

Quote from: davidcalvin on August 02, 2013, 01:09:39 PM
So the date that is actually in the gpx file needs to be that?

Yes.

QuoteDoes that mean that the gpx template file on the web site has the wrong format since it created that output?

No, it means that you have to use the -d option mentioned in the documentation to format the date/time correctly.

- 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 ($).

Phil Harvey

Quote from: davidcalvin on August 02, 2013, 01:12:53 PM
Tweaked the GPX file. Still not working, same error. Here is the update:

Oops, right.  The date must be separated by "-", not ":".  Like this: "2012-09-30T02:20:38.77Z".  As per the -d option in gpx.fmt.

- 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,

Okay. Progress is being made. When I recreated the track file, I am now getting the track point loaded, but the file is not being changed with the given gps data:


Argument "-Geotime<DateTimeOriginal" is assumed
Loaded 1 points from GPS track log file 'out.gpx'
  GPS track start: 2012:09:30 02:20:38 UTC
  GPS track end:   2012:09:30 02:20:38 UTC
Writing File:Geotag
======== BoraBora 36.jpg
Setting new values from BoraBora 36.jpg
  Geotime value:   2011:03:15 10:12:39 UTC (local timezone is -07:00)
Warning: Time is too far before track 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

Does this mean I need to change the creation date of the target image to match the gps date time stamp?

Thanks again,

David

Phil Harvey

Hi David,

I sort of expected this to happen.  Is there any reason why you don't just copy the GPS tags directly from the other file instead of going through a fake track log?:

exiftool -tagsfromfile SOURCE.jpg -gps:all DESTINATION.jpg

Otherwise, you could either change the time in the track log or relax the time constraint by setting GeoMaxExtSecs to an absurdly large number in the %Image::ExifTool::UserDefined::Options of the config file.

- 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 will try that next (modifying the config file). Ultimately, my goal is to stamp thousands of images with GPS tags from a database of locations. My preference would be to just write the GPS tags directly to the image, but when I try to do that with exiftool it errors out and tells me that that cannot be done. I guess what I was hoping to do was figure out how to spew a track file on the fly with the coordinates that I am interested in and stamp images repeatedly as necessary.

Is there a way to just make an image have a certain lat, long, and altitude without using a track file or another image? That would be ideal.

Thanks,

David

Phil Harvey

Hi David,

Quote from: davidcalvin on August 06, 2013, 11:38:55 AM
My preference would be to just write the GPS tags directly to the image, but when I try to do that with exiftool it errors out and tells me that that cannot be done.

More details are necessary to figure out what you were doing wrong.

QuoteIs there a way to just make an image have a certain lat, long, and altitude without using a track file or another image? That would be ideal.

Sure.  Lots of ways.  Directly from the command line:

exiftool -gpslatitude=30.14155 -gpslatituderef=N -gpslongitude=70.12727 -gpslongituderef=W FILE

- 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,

That seems to work. However, it turns negative numbers into positive ones:

overwrite_original  -gpslatitude='37.322944' -gpslongitude='-122.032305' '/Users/david/Pictures/LBReplicateCache/IMG_1504-1.CR2'

-a -u -g1 /Users/david/Pictures/LBReplicateCache/IMG_1504-1.CR2 | grep GPS


---- GPS ----
GPS Version ID                 : 2.3.0.0
GPS Latitude                    : 37 deg 19' 22.60"
GPS Longitude                  : 122 deg 1' 56.30"
GPS Position                    : 37 deg 19' 22.60", 122 deg 1' 56.30"

Is there a reason for this?

Thanks,

David

davidcalvin

I am guessing this is due to the neat for the ref parameter? The GPS Data I am working with doesn't  supply references, so I guess I have to detect negative/ positive and provide the refs?

Phil Harvey

Hi David,

Yes.  The EXIF GPS hemisphere is unfortunately stored separately (dumb, really).

But ExifTool is smart this way.  Just set the GPSLatitude/LogitudeRef to the same signed number as GPSLatitude/Longitude and it will assign the proper hemisphere.

- 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 ($).

tadej

Hi David,

newbie but trying hard.  8)
I tried to write lat and long to image file as suggested
exiftool -gpslatitude=30.14155 -gpslatituderef=N -gpslongitude=70.12727 -gpslongituderef=W jpg.jpg

An error is generated.
Error: Error reading StripOffsets data in IFD1

Does this mean that image has no gps tags yet and they must be added prior to write.

If yes, how do I add tags which are regular ones but do not exist in image.

Kind Regards


Phil Harvey

This error means that the EXIF is corrupted.  Read FAQ 20 for help fixing this.

- 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 ($).

tadej

Thanks Phil, works like magic.
But weird thing is that image wa taken by Cannon and was resized in Photoshop and saved.
Is there a simple way (not try-to-wite) to test if Exif is not corrupted.

I get Exif values when read is performed.
What exactly do you mean by saying Exif is corrupted.

Dusan