The "-P" option should be activated by default

Started by damjal, August 10, 2024, 05:13:48 AM

Previous topic - Next topic

damjal

I made a script to mass-modify the metadata of a photographer's large image bank in which the date of modification of images is very sensitive information. Unfortunately I didn't know that the date of modification of images was modified by default...

When you modify a photo's metadata, the photo's modification date, which in most cases for the photographer is the date the photo was taken, should not be modified by default.

Phil Harvey

As long as you didn't use the -overwrite_original option, you can restore all of the original files with the -restore_original feature.

Also, you can reset the FileModifyDate from ModifyDate in the metadata.  The metadata ModifyDate should be set when the image is edited.

I disagree that -P should be the default.  The default filesystem behaviour for all applications is to update the FileModifyDate when the file is changed.  ExifTool is no different.

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

wywh

#2
When file metadata is edited, in essence file is edited so FileModifyDate should also be modified.

Many backup apps rely using file size and FileModifyDate to determine if a file should be updated on the destination.

I routinely use -P because I prefer to keep file dates after editing metadata. Recently I noticed that a very tiny metadata edit failed to go to my backups (because the file size did not change a bit) and asked the backup author about this.

The backup app's author described -P as an egregious bug in the exiftool utility, but they call it a "feature". Anyway, that backup app has an advanced setting that uses md5 checksum but it is much slower than the default setting so I do not use it unless I really want to backup every tiny updated metadata.

I regard ExifIFD:DateTimeOriginal as the golden standard when the photo was taken and copy it to all other dates so spotting date errors is easier.

- Matti

Neal Krawetz

It really depends on your use model.

Sometimes I want to retain the timestamp.  Sometimes I don't.

I like having -P as an option, but not enabled by default.

StarGeek

Quote from: Phil Harvey on August 10, 2024, 06:21:27 AMThe default filesystem behaviour for all applications is to update the FileModifyDate when the file is changed.  ExifTool is no different.

To give examples, when you edit a document of any sort (Word, Excel, PowerPoint), you don't expect the file system time stamp to be preserved.

Quote from: damjal on August 10, 2024, 05:13:48 AMwhich in most cases for the photographer is the date the photo was taken, should not be modified by default.

I highly disagree with this statement. Most photographers who have a sizable collection are going to be using a Digital Asset Management (DAM) program, such as LightRoom, which is going to read the time stamp that is actually in the file.

Assuming you have video as well as image files, this command could be run to change all the FileModifyDate to the time stamp embedded in the file.
exiftool -api QuickTimeUTC "-FileModifyDate<CreateDate" "-FileModifyDate<DateTimeOriginal" /path/to/files/

You can set the -P (-preserve) option to be always used by adding it to your .ExifTool_config (see example.config file) under the Image::ExifTool::UserDefined::Arguments section.

A barebones config file to do this would be
# Specify default exiftool command-line arguments
# - inserted before all other options except -config
# - applies to all -execute'd commands
@Image::ExifTool::UserDefined::Arguments = (
    '-preserve', # Preserve the filesystem modification date/time (FileModifyDate) of the original file when writing
);
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).