Copying Original NEF Date/Time Information into XMPs, PSDs, TIFs and JPEGs

Started by DasBosun, October 31, 2012, 02:50:30 AM

Previous topic - Next topic

DasBosun

Shortly after making the move to Photoshop CS6, it appears that I've updated my XMP metadata template which I use in Bridge to 'replace' metadata within newly captured RAW files. After using Replace Metadata from Bridge's Tools menu, XMP sidecar files are created in which the Adobe Camera Raw image adjustments are subsequently registered. The net result within my workflow is about 3750 files (NEFs, XMPs, PSDs, TIFs and JPEGs) with the same template adjusted Date Created (file properties) and Date Time Original / Date Time Digitized (camera data Exif) fields. Everyone of these problem files now has the Date Created and the Date Time Original set as 16/12/2011, 10:28:38 AM. Curiously, the Date File Modified field remains correct with the actual capture time in the XMP sidecar files.

Since the metadata amendments are only written into the XMP sidecar files, the as captured NEF RAW files have maintained their original Date/Time information. I also understand that when an XMP file is present, Bridge or Lightroom read XMP data ahead of the original File Properties/Camera Data (Exif).

Being a newbie to ExifTool and tag editing, I'm totally overwhelmed by the possibilities present within Phil Harvey's ExifTool. Whilst the options, examples and tag name information that Mr Harvey has provided is nothing short of comprehensive; I am at a loose end as to how I might string together a command line and create .bat file which will correct the metadata template error that I've created. I've used .bat files previously within a backup application for Windows and I've tested some of the 'copying examples' using the ExifTool GUI, but I think it's fair to say that correcting my metadata template error is going to require a very specific ExifTool command line.

The following question assumes that all of the original NEFs, along with the XMPs, PSDs, TIFs and JPEGs will be contained in a single directory and that all of the different file types will share the original RAW filenames. Can the original Date/Time information contained in each NEF file be copied from the NEFs into the existing XMPs, PSDs, TIFs and JPEGs with a command line/.bat file? If so, what are the specific commands require?


DasBosun


Phil Harvey

This can be done, but the exact command line depends on your directory structure and file naming convention.  If we are lucky and the original raw image is in the same directory and has the same file name as the other files, then you can do this to update the specified metadata in all of the other files.

exiftool --ext nef -tagsfromfile %d%f.NEF -createdate -datetimeoriginal -r DIR

where DIR is the name of the root directory containing these files.

This is a very powerful command and you should test it out in a temporary directory first to make sure it does what you want, and you should have a back up of all your files because a simple typo with this command could cause it to also modify your NEF files.

Basically, what it does is search through DIR and all of its sub-directories for any file that is writable by Exiftool (TIFF, JPEG, XMP, etc) except NEF images, then copies the specified tags (CreateDate and DateTimeOriginal) from the corresponding NEF to each of these files.

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

DasBosun

I really do appreciate your response Phil. Many thanks; the suggested command-line worked as you've outlined, along with the fact that no changes were made to the original NEF files.

Using the ExifTool GUI and a bit of testing, I came to realise that the ModifyDate field also needed to be added to the command line:

exiftool --ext nef -tagsfromfile %d%f.NEF -createdate -datetimeoriginal -modifydate -r DIR

Now that I'm exclusively using the ExifTool GUI to view available metadata fields, I can see that the erroneous Bridge metadata template which I created has also changed the -IPTC:DateCreated and the -XMP-photoshop:DateCreated fields. Since neither of these fields exist in the original NEF files my question now becomes, is it possible to augment the provided command so that it also copies the -datetimeoriginal field from the NEFs into the -IPTC:DateCreated and the -XMP-photoshop:DateCreated fields of the XMPs, PSDs, TIFs and JPEGs?

Please accept my apology for coming back with an additional question, as I really should have foreseen the inclusion of these fields in my original post. Try as I might, I've been reading dozens of pages and forum posts, but I'm unable to amend the command line so that it performs this additional task.


DasBosun


Phil Harvey

I'm glad that worked.

With the addition of -modifydate, you are now copying the same tags as the -alldates sortcut (read here), so you can simplify your command line by replacing these 3 tags with -alldates if you want.

You can copy tags to do what you want with arguments like "-iptc:datecreated<datetimeoriginal" (the quotes are necessary).  ExifTool employs a bit of magic here, and will automatically use the date portion of a date/time value when writing a date-only tag like IPTC:DateCreated (and the time portion when writing IPTC:TimeCreated).

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

DasBosun

Thank you for all your direction Phil. Having now corrected approximately 3750 files, I'm northing short of wrapped with the results!

Prior to limiting my filenames back to their original 8 characters, I used Adobe Bridge's Batch Rename command to 'Preserve current filename in XMP Metadata'.

From there I split up the various file types and separately applied the following ExifTool command to limit each file type to their first eight characters:
exiftool -filename=%+8f.psd DIR
exiftool -filename=%+8f.tif DIR
exiftool -filename=%+8f.jpg DIR
exiftool -filename=%+8f.xmp DIR
exiftool -filename=%+8f.NEF DIR

With the filenames limited to 8 characters, I settled on these two command lines to copy the NEF Date/Time tags:

(for the XMPs)
exiftool --ext nef -tagsfromfile %d%f.NEF -alldates "-xmp-photoshop:datecreated<datetimeoriginal" -r DIR

(for the PSDs, TIFs and JPEGs I wanted keep their -modifydate intact (essentially the completion dates for the post production), so I only copied across the -createdate -datetimeoriginal tags)
exiftool --ext nef -tagsfromfile %d%f.NEF -createdate -datetimeoriginal "-xmp-photoshop:datecreated<datetimeoriginal" -r DIR


Many thanks

DasBosun