ExifTool Forum

ExifTool => The Image::ExifTool API => Topic started by: chuckkahn on December 02, 2018, 05:03:17 PM

Title: method to get timezones through Google Backup and Sync bottleneck
Post by: chuckkahn on December 02, 2018, 05:03:17 PM
This is not Perl specific, though I am trying to solve this problem with Perl.

How would I use ExifTool to fix this timezone uploading issue with Google Backup and Sync?

https://photos.app.goo.gl/Kk4UGO9ttSDF2whJ2

I take photos with the SnapCam LE.   I copy select photos to a folder that Google Back and Sync monitors and syncs from.  The photos show up on Google Photos but without timezone data.   Here's an album highlighting the issue:

https://photos.app.goo.gl/Kk4UGO9ttSDF2whJ2

I thought this might fix it.


my $exifTool = new Image::ExifTool;
# set specific information
$exifTool->SetNewValuesFromFile($starred_old, 'gpstimestamp<createdate');

my $result = $exifTool->WriteInfo($starred_old, $starred_new);


But the photos still show up on Google Photos without timezone info.  I'll try adding a 'filemodifydate<createdate' line next.
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: Phil Harvey on December 02, 2018, 05:08:52 PM
That was a good try. 

I'm afraid the question here is:

How does Google Photos determine the time zone?

This is a question for Google Photos, not ExifTool.

Once you know this, you can use ExifTool to set the appropriate metadata.

- Phil
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: chuckkahn on December 03, 2018, 09:59:18 AM
Quote from: Phil Harvey on December 02, 2018, 05:08:52 PM
That was a good try. 

I'm afraid the question here is:

How does Google Photos determine the time zone?

This is a question for Google Photos, not ExifTool.

Once you know this, you can use ExifTool to set the appropriate metadata.

- Phil

I contacted Google One and I hope I explained the issue clearly to Jason on the phone there because he says he never heard of this before.  He took down my information to pass on to a specialist and will get back to me. 
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: Phil Harvey on December 03, 2018, 10:09:12 AM
Quote from: chuckkahn on December 03, 2018, 09:59:18 AM
spe*02*t

Ha!  S P E C I A L I S T contains the word C I A L I S, which got removed by the forum spam filter.  :P

- Phil
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: chuckkahn on December 03, 2018, 12:26:09 PM
It's hard to demonstrate that the timezone is wrong because you only see the timezone as the account holder when you try to edit it.   Looking at the info pane on a shared album only reveals the date and time, not the timezone.  But this album was sorted by "newest first" and all the SnapCam LE photos end up at the bottom because they have no timezone as opposed to GMT-0500 iPhone photos.

https://photos.app.goo.gl/nt2G1Wt3n1JYa6ao9
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: chuckkahn on December 07, 2018, 09:06:18 PM
So should I try setting some general Lat/Long for my city and see if Backup and Sync translates that to Google Photos as timezone info?

my $exifTool = new Image::ExifTool;
# set specific information
$exifTool->SetNewValuesFromFile($starred_old, 'alldates<createdate');
$exifTool->SetNewValuesFromFile($starred_old, 'gpstimestamp<createdate');
$exifTool->SetNewValuesFromFile($starred_old, 'filemodifydate<createdate');
($success, $errStr) = $exifTool->SetNewValue('GPSLatitude' , '43.653225') or die $!;

print "success is $success errStr is $errStr\n";

$exifTool->SetNewValue('GPSLongitude','-79383186');
$exifTool->SetNewValue('GPSLatitudeRef','N');
$exifTool->SetNewValue('GPSLongitudeRef','W');



success comes out as 3 and errStr comes out as nothing but when I do 'exiftool photo.jpg' on the commandline I don't see any GPS data in the fields listed.

ExifTool Version Number         : 11.11
File Name                       : T7403477.JPG
Directory                       : Z:/Pictures/Narrative Clip/chuck.kahn@post-in-toronto.on.ca/SnapCam/2018/12/2018-12-06
File Size                       : 1881 kB
File Modification Date/Time     : 2018:12:06 20:34:50-05:00
File Access Date/Time           : 2018:12:07 20:47:57-05:00
File Creation Date/Time         : 2018:12:06 20:34:50-05:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Image Description               :
Make                            :
Camera Model Name               : 8M DSC
Orientation                     : Rotate 270 CW
X Resolution                    : 350
Y Resolution                    : 350
Resolution Unit                 : inches
Software                        : 1.0c00
Modify Date                     : 2018:12:06 20:34:51
Y Cb Cr Positioning             : Co-sited
Copyright                       : Copyright 2009
Exposure Time                   : 1/125
F Number                        : 2.0
Exposure Program                : Program AE
ISO                             : 500
Exif Version                    : 0230
Date/Time Original              : 2018:12:06 20:34:51
Create Date                     : 2018:12:06 20:34:51
Components Configuration        : Y, Cb, Cr, -
Compressed Bits Per Pixel       : 8
Shutter Speed Value             : 1/125
Aperture Value                  : 2.0
Exposure Compensation           : 0
Max Aperture Value              : 2.0
Metering Mode                   : Multi-spot
Light Source                    : Unknown
Flash                           : No Flash
Focal Length                    : 2.8 mm
Warning                         : [minor] Unrecognized MakerNotes
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 3264
Exif Image Height               : 2448
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Sensing Method                  : One-chip color area
File Source                     : Digital Camera
Scene Type                      : Directly photographed
Custom Rendered                 : Normal
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 21 mm
Scene Capture Type              : Standard
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
PrintIM Version                 : 0300
Compression                     : JPEG (old-style)
Thumbnail Offset                : 8230
Thumbnail Length                : 2376
Preview Image                   : (Binary data 26113 bytes, use -b option to extract)
Image Width                     : 3264
Image Height                    : 2448
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Aperture                        : 2.0
Image Size                      : 3264x2448
Megapixels                      : 8.0
Scale Factor To 35 mm Equivalent: 7.5
Shutter Speed                   : 1/125
Thumbnail Image                 : (Binary data 2376 bytes, use -b option to extract)
Circle Of Confusion             : 0.004 mm
Field Of View                   : 81.2 deg
Focal Length                    : 2.8 mm (35 mm equivalent: 21.0 mm)
Hyperfocal Distance             : 0.98 m
Light Value                     : 6.6
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: Phil Harvey on December 07, 2018, 09:17:40 PM
Did you call WriteInfo() to write the new tags to a file?

- Phil
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: chuckkahn on December 07, 2018, 09:49:46 PM
Yes....

my $result = $exifTool->WriteInfo($starred_old, $starred_new);
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: chuckkahn on December 07, 2018, 09:56:49 PM
and the result is 0
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: Phil Harvey on December 08, 2018, 07:28:20 AM
Try setting the Verbose option to 3 to see what you get when writing.

- Phil
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: chuckkahn on December 10, 2018, 11:40:55 AM
Quote from: Phil Harvey on December 08, 2018, 07:28:20 AM
Try setting the Verbose option to 3 to see what you get when writing.

You mean the -w perl flag?   Yes, it seems my minus sign was outside the degrees quotes when I switched to degrees minutes and seconds.   Now I see GPS data:

GPS Latitude                    : 43 deg 39' 54.80" N
GPS Longitude                   : 78 deg 39' 16.80" W
GPS Position                    : 43 deg 39' 54.80" N, 78 deg 39' 16.80" W


Now I wait for Backup and Sync to sync the photo to see if it works.   Is there a way to induce B&S to sync right now?
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: Phil Harvey on December 10, 2018, 12:28:20 PM
Quote from: chuckkahn on December 10, 2018, 11:40:55 AM
You mean the -w perl flag?

No.  I mean $exiftool->Options(Verbose => 3);

QuoteNow I wait for Backup and Sync to sync the photo to see if it works.   Is there a way to induce B&S to sync right now?

No idea.

- Phil
Title: Re: method to get timezones through Google Backup and Sync bottleneck
Post by: dabeamer on December 26, 2018, 01:39:35 AM
I ran into this issue a while back (not with Backup & Sync, but with Google Photos in general) -- here's a link to how we solved it for our use case (method would probably need to be adapted for yours, but thought it might help as there are comments included that detail our findings):
https://github.com/ab2tech/ab2foo/blob/master/scripts/forcegps.py

Also of note, Google ended up adding a batch time edit capability -- not exactly the cleanest method, but it's something to consider, especially for files you may have already uploaded.