ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: martinthomas on November 01, 2021, 01:17:32 PM

Title: GPS and rational64
Post by: martinthomas on November 01, 2021, 01:17:32 PM
I use Picasa to refine GPS location of images held on a local OneDrive folder.  After returning to a previously edited image, I have now discovered that OneDrive is overwriting my edited file with an older version.  What I have found is that OneDrive uploads the edited file as expected but shortly afterwards downloads an unedited version of the file (Microsoft are looking into this).

I am trying to find out how long this has been happening.

Using the Exiftool verbose option to investigate, I have found that there is a subtle difference between the GPS values in the original unedited version of the file and the GPS values in the OneDrive downloaded file.  The OneDrive downloaded file GPS values for seconds have been rounded.

Original unedited file
  GPSLatitudeRef = N
  GPSLatitude = 51 45 28.89404297 (51/1 45/1 59175/2048)
  GPSLongitudeRef = W
  GPSLongitude = 0 39 3.495583534 (0/1 39/1 3665385/1048576)

Edited file Uploaded
  GPSLatitudeRef = N
  GPSLatitude = 51 45 17.70172119 (51/1 45/1 290025/16384)
  GPSLongitudeRef = W
  GPSLongitude = 0 39 4.730472565 (0/1 39/1 1240065/262144)

Downloaded/overwritten file
  GPSLatitudeRef = N
  GPSLatitude = 51 45 28.894 (51/1 45/1 288940/10000)
  GPSLongitudeRef = W
  GPSLongitude = 0 39 3.4955 (0/1 39/1 34955/10000)

Although this subtle change is not significant in itself, it could indicate to me files which have been overwritten and need re-editing.   I am wondering if there is any way I could identify files with a rational64 denominator for seconds = 10000?
Title: Re: GPS and rational64
Post by: StarGeek on November 01, 2021, 02:42:59 PM
I don't believe there's a way to see the raw rational numbers outside of the -v (-verbose) option (https://exiftool.org/exiftool_pod.html#v-NUM--verbose) and no way to filter them.

Also be aware that OneDrive is not a backup for images.  It is editing your files.  See this thread (https://answers.microsoft.com/en-us/msoffice/forum/all/onedrive-personal-changing-jpg-image-files/4c7f0b22-1b4c-4a4f-8a99-67369e5dd176) on Microsoft.com.
Title: Re: GPS and rational64
Post by: Phil Harvey on November 01, 2021, 04:26:24 PM
Actually, I just realized there is a tricky way to show the rational values:

exiftool -p "${gpslatitude;$_=$self->GetValue($tag,'Rational')}, ${gpslongitude;$_=$self->GetValue($tag,'Rational')}" FILE

So you could filter on them like this:

exiftool -filename -if "${gpslatitude;$_=$self->GetValue($tag,'Rational')} =~ m(/10000)" DIR

- Phil
Title: Re: GPS and rational64
Post by: StarGeek on November 01, 2021, 04:53:42 PM
Quote from: Phil Harvey on November 01, 2021, 04:26:24 PM
exiftool -p "${gpslatitude;$_=$self->GetValue($tag,'Rational')}, ${gpslongitude;$_=$self->GetValue($tag,'Rational')}" FILE

When I copy/paste that command, I get an undef warning

C:\>exiftool -g1 -a -s -gpsl* y:\!temp\Test4.jpg
---- GPS ----
GPSLatitudeRef                  : North
GPSLatitude                     : 40 deg 41' 21.12"
GPSLongitudeRef                 : West
GPSLongitude                    : 74 deg 2' 40.20"
---- Composite ----
GPSLatitude                     : 40 deg 41' 21.12" N
GPSLongitude                    : 74 deg 2' 40.20" W

C:\>exiftool -p "${gpslatitude;$_=$self->GetValue($tag,'Rational')}, ${gpslongitude;$_=$self->GetValue($tag,'Rational')}"  y:\!temp\Test4.jpg
Warning: [Minor] Advanced formatting expression returned undef for 'gpslatitude' - y:/!temp/Test4.jpg
Title: Re: GPS and rational64
Post by: Phil Harvey on November 01, 2021, 08:08:28 PM
Ah, yes.  It will do that for Composite:GPSLatitude.  I didn't have the reference directions in my test file, which is why it worked for me.  Try this instead:

exiftool -p "${gps:gpslatitude;$_=$self->GetValue($tag,'Rational')}, ${gps:gpslongitude;$_=$self->GetValue($tag,'Rational')}" FILE

- Phil
Title: Re: GPS and rational64
Post by: StarGeek on November 01, 2021, 08:11:16 PM
That works perfectly.
Title: Re: GPS and rational64
Post by: martinthomas on November 03, 2021, 12:46:13 AM
Thanks for your help.  Phil's solution worked result = 51/1 45/1 59175/2048, 0/1 39/1 3665385/1048576
51/1 45/1 288940/10000, 0/1 39/1 34955/10000.

Perhaps the most important thing I have learnt is not to use OneDrive as a backup (unfortunately I have been using One Drive for some time as a back up images and to sync data onto another computer)

Martin
Title: Re: GPS and rational64
Post by: martinthomas on November 03, 2021, 01:02:29 AM
My only problem now is how to include commands for outputting directory and file name and make it recursive.

Martin
Title: Re: GPS and rational64
Post by: StarGeek on November 03, 2021, 01:33:42 AM
Quote from: martinthomas on November 03, 2021, 01:02:29 AM
My only problem now is how to include commands for outputting directory and file name and make it recursive.

exiftool -r -p "$FilePath, ${gps:gpslatitude;$_=$self->GetValue($tag,'Rational')}, ${gps:gpslongitude;$_=$self->GetValue($tag,'Rational')}" /path/to/files/
Title: Re: GPS and rational64
Post by: martinthomas on November 03, 2021, 06:42:55 AM
Thanks StarGeek - that worked perfectly.  Martin