News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Write datetimeoriginal to IPTC JPG keywords

Started by Tribo0n, March 27, 2019, 05:52:41 AM

Previous topic - Next topic

Tribo0n

How can i write the datetimeoriginal modeified to the iptc JPG keywords field?
For example datetimeoriginal = 2003:10:31 15:44:19
2003 should be added to keywords and 311003 should be added also
how can i do this?

Thanks a lot

Phil Harvey

Try this:

exiftool -addtagsfromfile @ "-keywords<${datetimeoriginal;s/:.*//}" "-keywords<${datetimeoriginal;s/^\d\d(\d\d):(\d\d):(\d\d).*/$3$2$1/}" DIR

Use +< instead of < if you want to add to existing keywords.

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

Tribo0n

Thanks for help. I use fotostation and the comand line is limited so the script is cut at the end
-overwrite_original -addtagsfromfile @ "-keywords+<${datetimeoriginal;s/:.*//}" "-keywords+<${datetimeoriginal;s/^\d\d(\d\d):(\d\d):(\d\d).*/$3$2$1/}"
is cutted to
-overwrite_original -addtagsfromfile @ "-keywords+<${datetimeoriginal;s/:.*//}" "-keywords+<${datetimeoriginal;s/^\d\d(\d\d):(\
Is there a way to abbreviate the script?

Phil Harvey

Sure.

Make a text file containing this:

-overwrite_original
-addtagsfromfile
@
-keywords+<${datetimeoriginal;s/:.*//}
-keywords+<${datetimeoriginal;s/^\d\d(\d\d):(\d\d):(\d\d).*/$3$2$1/}


and use this fotostation command:

-@ /path/to/your/file.txt
...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 ($).

Tribo0n


Tribo0n

Sorry, i saw a mistake now.
If i change the date of the picture in the fotostation and then run the script again, it just add the last value, not the correct picture taken date.
Whats wrong?

Thanks

Phil Harvey

Is Fotostation changing DateTimeOriginal?  The command I gave should use the value shown with this:

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

Tribo0n

my fault. We uses the field DateCreated
i Changed the txt and now it works. thanks