In one of my catalogs I have approximately 900 images with wrong EXIF date stamps.
They are all set to 2003:01:01 00:00:00
This occurred most likely because the owner of the camera forgot to set the correct date and time after changing the batteries.
These images all appear as expected in January 2003 in the timeline .
The only different date I can find in the metadata is the date the images were imported from the SD card to the PC by Microsoft Photos.
As this is the only somewhat sensible date information available in the files I wonder if this can be copied to the other date fields so that the files show up in a more sensible place in the timeline?
I suspect this requires some scripting but my scripting abilities are almost non-existent……
FWIW I attach a full EXIF dump of one of the files.
Any help will be highly appreciated!
Fill EXIF date stamps from MS Photo Date Acquired?
Fill EXIF date stamps from MS Photo Date Acquired?
- Attachments
-
- Full EXIF Dump.zip
- (1.66 KiB) Downloaded 396 times
Re: Fill EXIF date stamps from MS Photo Date Acquired?
Try this script...I haven't tried it as I don't have photos with that date filled. Run it on one or two copied photos first to test it.
Use with caution as this will change the rmetadata for your files.
Use with caution as this will change the rmetadata for your files.
Code: Select all
function HandleImageItem(AImageItem: TImageItem): Boolean;
var
AVal: Variant;
AXmp: TXMP;
begin
result := False;
AXMp := TXMP.Create(nil)
try
if PublicCatalog.LoadXMPForImage(AImageItem, AXmp, PublicOptions.CachedXMP) then
begin
AVal := AXmp.QuickGetProperty('http://ns.microsoft.com/photo/1.0/', 'MicrosoftPhoto:DateAcquired');
if not VarIsNull(AVal) then
begin
AXmp.QuickSetProperty('http://ns.adobe.com/exif/1.0/', 'exif:DateTimeOriginal', AVal);
AXmp.QuickSetProperty('http://ns.adobe.com/exif/1.0/', 'exif:DateTimeDigitized', AVal);
PublicCatalog.SaveXMPForImage(AImageItem, AXmp, PublicOptions.CachedXMP);
result := True;
end;
end;
finally
AXmp.Free;
end;
end;
var
i: Integer;
AProgress: TxomProgress;
begin
if Selected.Count = 0 then
begin
Say ('No images selected');
exit;
end;
if not Ask ('This script will write the Microsoft Acquired date as Exif dates for the ' + IntToStr(Selected.Count) + ' selected thumbnails.' + CrLf2 + 'Are you sure you want to continue?') then
exit;
AProgress := TxomProgress.Create(nil);
try
AProgress.Caption := 'Update Exif dates';
AProgress.Cancel := False;
AProgress.ProgressBar := True;
AProgress.Max := Selected.Count;
AProgress.Show;
for i := 0 to Selected.Count - 1 do
begin
AProgress.ProgressText := Selected.Items[i].FileName;
AProgress.Pos := i + 1;
if AProgress.Cancel then
break;
HandleImageItem(Selected.Items[i]);
end;
AProgress.Hide;
if AProgress.Cancel then
Say('Cancelled')
else
Say('Done');
finally
AProgress.Free;
end;
end;
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
Re: Fill EXIF date stamps from MS Photo Date Acquired?
Thank you Hert for helping me.
Unfortunately the script did not change the Exif dates.
Would it help if I send you an example file with the MS date filled?
Unfortunately the script did not change the Exif dates.
Would it help if I send you an example file with the MS date filled?
Re: Fill EXIF date stamps from MS Photo Date Acquired?
Sorry, my bad!
I had the write-back options set to keep everything local to the database.
The script works as intended, thank you!
(Reminder to self: check settings before jumping to conclusions....)
Thank you again!
I had the write-back options set to keep everything local to the database.
The script works as intended, thank you!
(Reminder to self: check settings before jumping to conclusions....)
Thank you again!