ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: dgood on March 09, 2018, 07:06:24 PM

Title: Setting Exif Date/Time Original and GPS Date/Time tags at once
Post by: dgood on March 09, 2018, 07:06:24 PM
Hello,
I'd like to take an image with no Date/Time metadata (but the date/time is the filename) and put in the Exif tags for the Date/Time Original and GPS Date Time, all in the same Exiftool command. Is that possible?

Right now I run two commands. The first is:

exiftool -exif:timezoneoffset=-8 -exif:OffsetTimeOriginal="-08:00" -exif:OffsetTime="-08:00" -exif:OffsetTimeDigitized="-08:00" -datetimeoriginal<filename -modifydate<filename -createdate<filename image.jpg

And only then, run my second command:

exiftool -exif:gpstimestamp<${datetimeoriginal}-08:00 -exif:gpsdatestamp<${datetimeoriginal}-08:00 -exif:GPSMapDatum="WGS-84" -exif:GPSVersionID="2.3.0.0" image.jpg

Is there a way to do this in a single command? Thanks for your help!
Title: Re: Setting Exif Date/Time Original and GPS Date/Time tags at once
Post by: Phil Harvey on March 10, 2018, 09:54:43 PM
It may require some reformatting of the file name to write gpsdatestamp and gpstimestamp.  This may be done with the advanced formatting feature.  Can you provide an example of how the files are named?

- Phil
Title: Re: Setting Exif Date/Time Original and GPS Date/Time tags at once
Post by: dgood on March 11, 2018, 05:49:48 PM
Thanks for replying on a weekend :)
Filenames are formated: YYYY-MM-DD hh.mm.ss.jpg
Title: Re: Setting Exif Date/Time Original and GPS Date/Time tags at once
Post by: Phil Harvey on March 12, 2018, 07:21:48 AM
I think that this should work, allowing you to combine your two commands into one:

"-gpsdatestamp<${filename;tr/-./::/}-08:00" "-gpstimestamp<${filename;s/.* //;tr/./:/}-08:00"

Unfortunately, GPSDateStamp and GPSTimeStamp aren't as flexible in the formatting that they allow, but the advanced formatting expression can give them what they want.

- Phil
Title: Re: Setting Exif Date/Time Original and GPS Date/Time tags at once
Post by: dgood on March 12, 2018, 12:17:54 PM
Thanks Phil.
My input is:

exiftool -datetimeoriginal<filename -modifydate<filename -createdate<filename '-gpsdatestamp<${filename;tr/-./::/}-08:00' '-gpstimestamp<${filename;s/.* //;tr/./:/}-08:00' -overwrite_original image.jpg

Where "image.jpg" = my image dragged and dropped from the MacOS finder.
Output is:

-bash: filename: No such file or directory

I'm using MacOS High Sierra (10.13.3) and Exiftool ver. 10.83
Title: Re: Setting Exif Date/Time Original and GPS Date/Time tags at once
Post by: Phil Harvey on March 12, 2018, 12:27:44 PM
You need quotes around arguments containing a '<'.
Title: Re: Setting Exif Date/Time Original and GPS Date/Time tags at once
Post by: dgood on March 12, 2018, 12:51:57 PM
Ugh. Yes, I do. Thanks Phil!