Re-Read some Metadata from NEF not from XMP

lippe
Posts: 296
Joined: 12 Aug 06 11:26
Location: Wondelgem (Belgium)

Re: Re-Read some Metadata from NEF not from XMP

Post by lippe »

Michael, now that you are a experienced scripter, would you been so kind to share the PSU- version of the script?
Thank you very much!
Lippe, (unexperienced scripter)
Photo Supreme V6, LR6, darktable, FPV, PSE14 - vaio i5 @ 2.5GHz + 8GB , 850 EVO 500GB - WD 1TB - Windows 10 Pro 64 bits- DS216play - EOS 600D
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Re-Read some Metadata from NEF not from XMP

Post by weidmic »

Hi Lippe, This script seems to do a bit more than the implemented "import metadata to xmp"
I have used the script for more than 10k images with great success :)

Code: Select all

{
  Description: This script will migrate the existing meta information from the image to XMP; use it with Photo Supreme
  Author: Hert, edited by weidmic
  Initial date: 2005-01-18
}

var
  ATif: TTif;
  AXmp: TXMP;
  AItem: TImageItem;
  i: Integer;
  ACatItem: TCatalogItem;
begin
  if Selected.Count = 0 then
  begin
    Say ('No selection made.');
    exit;
  end;


  AXmp := TXmp.Create (False);
  ATif := TTif.Create (nil);
  ACatItem := TCatalogItem.Create (nil);
  try
    for i := 0 to Selected.Count - 1 do
    begin


      ATif.Reset;
      AXmp.Reset;

      ATif.FileName := Selected.Items[i].ExifFileName;
      ATif.Load (True, False);

      // now update the XMP
      if not Catalog.FindImageCombined (Selected.Items[i], ACatItem, False, phtNone) then
        if not Catalog.AddFile (Selected.Items[i], AcatItem, False) then
          Continue;

      Catalog.LoadXMPForItem (ACatItem, AXmp, Options.CachedXMP);
      AXmp.InitializeFromTif (ATif, True, True, True, False, txusAll);
      Catalog.SaveXMPForItem (ACatItem, AXmp, Options.CachedXMP);
    end;
  finally
    AXmp.Free;
    ACatItem.Free;
  end;


end;
Cheers,
Michael
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
lippe
Posts: 296
Joined: 12 Aug 06 11:26
Location: Wondelgem (Belgium)

Re: Re-Read some Metadata from NEF not from XMP

Post by lippe »

weidmic wrote:Hi Lippe, This script seems to do a bit more than the implemented "import metadata to xmp"
Michael, after running the script, it seems that copyright notice is lost. While the Import meta to XMP seems to preserve this information.
Lippe :? .
Photo Supreme V6, LR6, darktable, FPV, PSE14 - vaio i5 @ 2.5GHz + 8GB , 850 EVO 500GB - WD 1TB - Windows 10 Pro 64 bits- DS216play - EOS 600D
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Re-Read some Metadata from NEF not from XMP

Post by weidmic »

Lippe,

My camera is writing my name into the copyright field (EXIF nef) - which I want....
When I then execute the script, it will read the value in the exif and overwrite my more sophisticated copyright notice.

That is a little drawback; because I have a formula for the copyright notice, I don't care a lot - I just rewrite the copyrights later again.
I think the script works as it should.

I am sure there would be a way to edit the script that it does exclude a certain exif property.
To make that happen, it needs a very experienced scripter. Experienced is not enough for this :)

Cheers,
Michael
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
Hert
Posts: 7870
Joined: 13 Sep 03 6:24

Re: Re-Read some Metadata from NEF not from XMP

Post by Hert »

Lippe,

Not sure if this will help, but try to change the fifth parameter of the call to InitializeFromTif from False to True

Hert
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Re-Read some Metadata from NEF not from XMP

Post by weidmic »

Code: Select all

AXmp.InitializeFromTif (ATif, True, True, True, True, txusAll)
No, it does not...
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
Hert
Posts: 7870
Joined: 13 Sep 03 6:24

Re: Re-Read some Metadata from NEF not from XMP

Post by Hert »

Ok, leave it as False then.

The second parameter specifies that the Tiff base tags should be converted
The third parameter specifies that Exif should be converted (maybe you should switch this off)
The fourth parameter specifies that IPTC should be converted
The fifth parameter specifies that XMP is leading

The order of handling is in that exact order. Btwl the Image Details conversion uses True, True, True, False so exactly the same as this script

Hert
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Re-Read some Metadata from NEF not from XMP

Post by weidmic »

Thanks for the info!

Regards,
Michael
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
tstoddard
Posts: 605
Joined: 07 Sep 12 11:51

Re: Re-Read some Metadata from NEF not from XMP

Post by tstoddard »

IDimager wrote:Maybe this helps??

http://repository.idimager.com/cgi-bin/ ... 1cf5a2d130

Maybe you need to delete all the progress usage but it should get you started.
Hert,

I'm jumping into this conversation a little late but I'm curious about the script. Why do you need to delete the progress stuff? Is it not supported in PSU? If so, is there some other way to display the progress of the script in PSU?

Also, if this script was used on jpeg files, would it work and just write embedded xmp to the file? Would it overwrite any xmp that already existed? Is that what "XMP is leading" refers to?
Tom Stoddard
lippe
Posts: 296
Joined: 12 Aug 06 11:26
Location: Wondelgem (Belgium)

Re: Re-Read some Metadata from NEF not from XMP

Post by lippe »

IDimager wrote: Btwl the Image Details conversion uses True, True, True, False so exactly the same as this script
I tested this again with the "True, True, True, False" but the results are not the same! (copyrightnotice still missing)

Only if set the fifth parameter to True, the copyrightnotice is retained. So when specifying that "XMP is leading", only the missing tags will converted from exif to xmp?

It is not so simple...

After running the script, the file will go out-of-sync. I noticed the copyrightnotice was updated from the XMP in the file but the color label was not. Now, depending on how you sync:
Auto sync => the catalog information will be leading and the color label will overwritten to
Read Metadata from File => the xmp in the image file will be leading and color label will change in the catalog.
Lippe, :?
Photo Supreme V6, LR6, darktable, FPV, PSE14 - vaio i5 @ 2.5GHz + 8GB , 850 EVO 500GB - WD 1TB - Windows 10 Pro 64 bits- DS216play - EOS 600D
Hert
Posts: 7870
Joined: 13 Sep 03 6:24

Re: Re-Read some Metadata from NEF not from XMP

Post by Hert »

Converting metadata to XMP for multiple images is now added to the .170 build. It is implemented in the thumb's context menu -> Metadata -> Convert Metadata to XMP
I couldn't find a feature request for this in Mantis. I was convinced that there was one created once by Weidmic, but I could be wrong.
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
Post Reply