RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
2.17k stars 100 forks source link

Add DocumentID and ImageUniqueID to exiftool and XMP output #1510

Open RhetTbull opened 7 months ago

RhetTbull commented 7 months ago
          Found it.

The field that should be set is ImageUniqueID. Right now PhotoPrism only reads this field from exiftool and not XMP but I guess it can't hurt to set it in both for future proofing. ImageUniqueID must be a UUID for this to work, I believe that is the case with Apple Photos Identifiers, correct? This worked for me:

exiftool -overwrite_original -ImageUniqueID="51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25" Film0103.edited.jpeg
exiftool -overwrite_original -ImageUniqueID="51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25" Film0103.jpg
exiftool -overwrite_original -ImageUniqueID="51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25" Film0103.nef

Edit: It appears that DocumentID field is also supported. I ran the following commands on the 3 (original) output files and it got them stacked in PhotoPrism:

exiftool -overwrite_original -DocumentID="51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25" Film0103.edited.jpeg
exiftool -overwrite_original -DocumentID="51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25" Film0103.jpg
exiftool -overwrite_original -DocumentID="51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25" Film0103.nef

Originally posted by @odedia in https://github.com/RhetTbull/osxphotos/issues/1508#issuecomment-2049372678

RhetTbull commented 7 months ago

The fields are:

  "EXIF:ImageUniqueID": "51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25",
  "MakerNotes:ImageUniqueID": "51b2fbb7d7d5ad4d41d99c8de96e1a1a0f25",
  "XMP:DocumentID": "51b2fbb7-7d5a-4d41-99c8-e96e1a1a0f25",

MakeNotes cannot be written by exiftool if it doesn't already exist. I didn't set MakerNotes so it got set because -ImageUniqueID was specified so exiftool set both matching tags.

MakerNotes should probably be updated but this requires custom code if it doesn't already exist (see makelive).