Exiftool and iterative changes

Started by camner, September 27, 2024, 11:50:15 PM

Previous topic - Next topic

camner

I'm executing the following code:
exiftool \
-AllDates="1983:04:01 01:17:00" \
"-IPTC:DateCreated < EXIF:DateTimeOriginal" \
"-IPTC:TimeCreated < EXIF:DateTimeOriginal" \
"-IPTCDigest=new"

What I was hoping would happen is that the IPTC:DateCreated tag would end up with 4/1/1983, but it doesn't seem to.  In my test, the IPTC:DateCreated tag ended up with the value of EXIF:DateTimeOriginal as of BEFORE exiftool was run.

The only way I can think of to get around this is by running ExifTool twice, once to change the date and then a second time to change the IPTC tags.

Am I missing something here, or do I have the only solution?

StarGeek

Why not set the IPTC tags to the same value at the same time?

exiftool -AllDates="1983:04:01 01:17:00" -IPTC:DateCreated="1983:04:01 01:17:00" -IPTC:TimeCreated="1983:04:01 01:17:00" -IPTCDigest=new /path/to/files/

Alternatively, you could create a shortcut tag to write all of them at the same time. If you don't already have an .ExifTool_config file (see the example.config file), you can create a minimal one with just the shortcut in it.

%Image::ExifTool::UserDefined::Shortcuts = (
    MyAllDates=> ['CreateDate','ModifyDate','DateTimeOriginal','DateCreated','TimeCreated'],
);

You would then just use
exiftool -MyAllDates="1983:04:01 01:17:00" /path/to/files/
and it would write all five tags at the same time.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

camner

Quote from: StarGeek on September 28, 2024, 01:11:19 AMWhy not set the IPTC tags to the same value at the same time?

exiftool -AllDates="1983:04:01 01:17:00" -IPTC:DateCreated="1983:04:01 01:17:00" -IPTC:TimeCreated="1983:04:01 01:17:00" -IPTCDigest=new /path/to/files/

Alternatively, you could create a shortcut tag to write all of them at the same time. If you don't already have an .ExifTool_config file (see the example.config file), you can create a minimal one with just the shortcut in it.

%Image::ExifTool::UserDefined::Shortcuts = (
    MyAllDates=> ['CreateDate','ModifyDate','DateTimeOriginal','DateCreated','TimeCreated'],
);

You would then just use
exiftool -MyAllDates="1983:04:01 01:17:00" /path/to/files/
and it would write all five tags at the same time.
Thanks for the tips. I've never created a shortcut tag, but I can see that it would be useful.

I realize now that I should have provided more context rather than just asking a question.

I am working on a large project to take about 6000 scans of negatives, prints, and slides and assigning dates to them (with a scheme that allows me to identify when dates are exact, when only the month is known, etc.)

I am not doing this directly in ExifTool.  I use Lightroom to manage images, and I am using a plugin that is a front end to ExifTool. I am doing that because I will have groups of pictures to which I will assign the same date, and I want to increment the timestamp seconds for different images that are assigned the same date so that they will sort appropriately. The plugin does this via a very convenient interface. When assigning a date, the plug-in creates the command
"[i]Alldates[/i] = specific date" The plugin also permits the user to add other ExifTool commands, and I added the IPTC tag assignments I mentioned in my original post. That's how I discovered that ExifTool didn't behave as I thought it might (making one change at a time allowing the result of one change to affect a later one).

I suppose I could change the additional custom line so that the assignment of the IPTC tags is to a specific date rather than being read from another tag, but that will lengthen the process, and this is going to be a very time-consuming process as it is, and I was hoping I could find a way to create a workflow that it has efficient as I can figure out how to make it.

StarGeek

You could override the default tags that AllDates writes with a config file. Just change "MyAllDates" to AllDates in the above config and save it to a file called .ExifTool_config in the same directory as the exiftool that the Lightroom plugin is using. AllDates now writes to all the tags that you want.

Example. First command lists the contents of temp.txt, which is the config file in this case. Then the date/time tags in Test4.jpg, which shows only the DateTimeOriginal tag. Then setting the new AllDates to a new value with the next command showing what was written.
C:\>type temp.txt
%Image::ExifTool::UserDefined::Shortcuts = (
    AllDates=> ['CreateDate','ModifyDate','DateTimeOriginal','DateCreated','TimeCreated'],
);

C:\>exiftool -time:all --system:all -G1 -a -s y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2000:01:01 12:00:00

C:\>exiftool -config temp.txt -P -overwrite_original -Alldates="2024:09:29 12:00:00" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -time:all --system:all -G1 -a -s y:\!temp\Test4.jpg
[IFD0]          ModifyDate                      : 2024:09:29 12:00:00
[ExifIFD]       DateTimeOriginal                : 2024:09:29 12:00:00
[ExifIFD]       CreateDate                      : 2024:09:29 12:00:00
[IPTC]          DateCreated                     : 2024:09:29
[IPTC]          TimeCreated                     : 12:00:00-07:00
[Composite]     DateTimeCreated                 : 2024:09:29 12:00:00-07:00
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

camner

Very clever! I'll give this a whirl.  Thanks.