Setting Exif Date/Time Original and GPS Date/Time tags at once

Started by dgood, March 09, 2018, 07:06:24 PM

Previous topic - Next topic

dgood

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!

Phil Harvey

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

dgood

Thanks for replying on a weekend :)
Filenames are formated: YYYY-MM-DD hh.mm.ss.jpg

Phil Harvey

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

dgood

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

Phil Harvey

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