how to write CreateDate from raw into xmp?

Started by niels123, September 01, 2016, 06:58:10 AM

Previous topic - Next topic

niels123

I shot a wedding with a new (secondhand 5D III) and messed things up a little bit because the date/time on the cameras differ by about 1min30s. This causes issues in the order of the photos.

I discovered after I edited a bunch of photos and don't want to loose my edits. LR takes the CreateDate directly from the XMP, not from the raw if the xmp is there (which also stores the edits, so I cannot delete the xmp).

I used pyExifToolGUI and thought that I fixed it, however, it refreshed all my raws with the current system date in my PC, instead of doing the same incremental change to each raw. I have a backup of the original, unmodified CR2 files and want to use these instead because I now know how to do it on the CR2's in pyExifToolGUI.

To get the change in Lightroom I need some way to update the xmp to the same date as well. How to I tell exiftool to directly read the CreateDate from the raw and write this date in the xmp as CreateDate, DateTimeOriginal and ModifyDate?

Phil Harvey

First, I would think that pyExifToolGUI only changed the filesystem date/times to the current date.  You can set these back to any date/time tag from the metadata to undo-do this, like this:

exiftool "-filemodifydate<datetimeoriginal" "-filecreatedate<datetimeoriginal" FILE

Copying tag values between files is easy.  The syntax for the command you are looking for is:

exiftool -tagsfromfile SOURCE.cr2 -createdate -datetimeoriginal -modifydate DESTINATION.xmp

See the COPYING EXAMPLES section of the exiftool application documentation for lots more examples.  And read up on the -tagsFromFile option in this documentation for full details.

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

niels123

Thanks a lot for the quick reply!

I put in a bat file:
"c:\program files\exiftool\exiftool.exe" -tagsfromfile %%d%%f.cr2 -createdate -datetimeoriginal -modifydate %%d%%f.xmp -r DIR
It gives me:
Warning: Error opening file %d%f.cr2"

If I look in the dir, I also have CR2_original files now.

Phil Harvey

Try this in your .bat file:

"c:\program files\exiftool\exiftool.exe" -tagsfromfile %%d%%f.cr2 -createdate -datetimeoriginal -modifydate -r -ext xmp DIR

But first you should probably restore your original CR2 files:

"c:\program files\exiftool\exiftool.exe" -restore_original -r DIR

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

niels123

Thanks it works!

I created a backup copy of the entire dir before executing any but, so I just emptied the bat - dir and filled it up again from my backup.  :)

Now all the photos from both cameras are in proper order. Especially with ceremonies, it can look quite weird if the order is not chronological  ;)