简体   繁体   中英

Inserting 'date taken' from a photo's 'date created' field IF the 'date taken' field is empty

I was wondering if there's a way to mass change a series of photos based on the 'date created' field IF the 'date taken' field is empty?

Essentially I'm trying to create a way so the script looks at the image, if the Date Taken is empty than it adds the Dare Created as the Date Taken field, if the Date Taken field has a value then it moves on.

Maybe ExifTool could do this, but I'm still looking into how it can be done.

You don't mention the OS, but this answer will apply mostly to Windows, with a caveat for use with Mac and video files at the end.

Part of the problem is that there is no "Date Taken" tag. In Windows, this property is filled from five different possible tags, though EXIF:DateTimeOriginal is probably the best tag to copy to.

The secondary problem is what tag exactly is your "Date Created" tag. Since metadata is such a hot mess, there is half a dozen tags that could fill the property. It all depends upon what your are using to view the "Date Created".

Using exiftool, In order to figure out what tag you want to copy from ("Date Created"), run this command on a file
exiftool -time:all -G1 -a -s /path/to/file/

You would then examine the output to find the name of the tag you want to copy from. You could then run this command, replacing "SOURCETAG" with the actual name of the tag you want to copy from
exiftool "-AllDates<SOURCETAG" /path/to/files/

AllDates is a shortcut for the three most common timestamp tags: DateTimeOriginal , ModifyDate , and CreateDate . These should cover the "Date Taken" property.

This command creates backup files. Add-overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.

Additional notes, for PNG files under Windows, you would use PNG:CreationTime instead of AllDates . For video files (MP4/Mov) under Mac, you do not want to copy the timestamp to DateTimeOriginal unless you include a timezone, as this will cause the Photos app to display corrupted timestamps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM