How to insert hierarchical subject into Lightroom images?

Started by stasiana, July 29, 2011, 02:56:35 PM

Previous topic - Next topic

stasiana

I'd like to use exiftool to add hierarchical subjects to images so that I can script the import of images before I add them to Lightroom. I tried to do the following:

$ exiftool -XMP:HierarchicalSubject="people|Test" Test.jpg
    1 image files updated

$ exiftool -G -j -n Test.jpg | grep Test
  "SourceFile": "Test.jpg",
  "File:FileName": "Test.jpg",
  "XMP:HierarchicalSubject": "people|Test",
  "XMP:RawFileName": "Test.jpg",


It seemed to insert the proper tag into the file, but despite my telling Lightroom to re-read metadata from the file, Lightroom doesn't show the hierarchical subject. However, if I use XMP:Subject, then it shows the subject but it's not in the hierarchy I want.

Any pointers?

Phil Harvey

This looks correct to me, and I think this should work for LR3 (XMP-lr:HierarchicalSubject I mean).  Is this the version of LR you are using?  If not, I suggesting writing some hierarchical keywords with LR to see where they go, then use ExifTool to put them in the same spot (as per FAQ 3).  At some point I expect Adobe may update to use the XMP-mwg-kw:HierarchicalKeywords tag instead since they participated in the development of this specification.

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

stasiana

Thanks for the feedback, Phil.

I am using Lightroom 3.4, but it doesn't work for me. I do see that for images that Lightroom tags, it does fill in the same field, which has me confused. Is it possible that something is masking Lightroom's reading of this field?

I tried it with another image with the same results, but I captured the exiftool output and diff'ed them.

This is before import into LR and after import into LR and adding a hierarchical subject:

6,7c6,7
<   "File:FileSize": 57155,
<   "File:FileModifyDate": "2011:07:29 16:34:58-07:00",
---
>   "File:FileSize": 60207,
>   "File:FileModifyDate": "2011:07:29 16:36:02-07:00",
10a11,12
>   "File:ExifByteOrder": "MM",
>   "File:CurrentIPTCDigest": "7299823d8f21d3283b54a517a7588a70",
21a24,34
>   "EXIF:Orientation": 1,
>   "EXIF:ExifVersion": "0221",
>   "XMP:XMPToolkit": "Adobe XMP Core 5.2-c004 1.136881, 2010/06/10-18:11:35        ",
>   "XMP:MetadataDate": "2011:07:29 16:36:02-07:00",
>   "XMP:RawFileName": "q1.jpg",
>   "XMP:HierarchicalSubject": "people|AAA",
>   "XMP:Subject": ["AAA","people"],
>   "IPTC:CodedCharacterSet": "\u001B%G",
>   "IPTC:ApplicationRecordVersion": 4,
>   "IPTC:Keywords": ["AAA","people"],
>   "Photoshop:IPTCDigest": "7299823d8f21d3283b54a517a7588a70",


This is after adding the first subject and after adding a second subject:

6,7c6,7
<   "File:FileSize": 60207,
<   "File:FileModifyDate": "2011:07:29 16:36:02-07:00",
---
>   "File:FileSize": 60284,
>   "File:FileModifyDate": "2011:07:29 16:36:10-07:00",
12c12
<   "File:CurrentIPTCDigest": "7299823d8f21d3283b54a517a7588a70",
---
>   "File:CurrentIPTCDigest": "366c8ee4d52a05481d461677a04da172",
27c27
<   "XMP:MetadataDate": "2011:07:29 16:36:02-07:00",
---
>   "XMP:MetadataDate": "2011:07:29 16:36:10-07:00",
29,30c29,30
<   "XMP:HierarchicalSubject": "people|AAA",
<   "XMP:Subject": ["AAA","people"],
---
>   "XMP:HierarchicalSubject": ["people|AAA","people|BBB"],
>   "XMP:Subject": ["AAA","BBB","people"],
33,34c33,34
<   "IPTC:Keywords": ["AAA","people"],
<   "Photoshop:IPTCDigest": "7299823d8f21d3283b54a517a7588a70",
---
>   "IPTC:Keywords": ["AAA","BBB","people"],
>   "Photoshop:IPTCDigest": "366c8ee4d52a05481d461677a04da172",


If I take a clean file, add it to Lightroom, then using exiftool modify the HierarchicalSubject and MetadataDate tags, then reload the metadata into Lightroom, the subjects still don't show up. BUT,  re-reading the tags from exiftool, I find that the HierarchicalSubject tag I entered has disappeared.

It seems like Lightroom is now using the digests to verify that it added the subjects, and if it didn't, removes them?????


Phil Harvey

It looks like LR may be ignoring the XMP in favour of the IPTC.  There are 2 things you can do:

1) delete all IPTC and use XMP only.  (easy, but not as compatible with other software)

2) use exiftool to also update the IPTC Keywords and IPTCDigest.  Use "-IPTCDigest=new" to update the Photoshop IPTCDigest whenever you change anything in the IPTC (this is mentioned in the Photoshop tag name documentation).

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