Bug #784
Writing Xmp.lr.hierarchicalSubject writes wrong datatype
100%
Description
Right now, exiv2 writes the Xmp.lr.hierarchicalSubject field as XmpText when it should be an XmpBag. This isn't surprising, being that the Adobe Lightroom schema (which defines Xmp.lr.hierarchicalSubject) isn't supported. So maybe this is a "feature" (support the Lightroom schema) more than a "bug", but it seems like a bug to me. I hack on Shotwell, a popular, open-source photo organizer for GNOME, and because of this issue we can't write out tags that are intelligible to Adobe Lightroom users. This is exceedingly unfortunate, because Lightroom is the most popular pro-level commercial photo organizer in the world. :-(
Files
Related issues
History
Updated by Andreas Huggel over 10 years ago
- Status changed from New to Feedback
Well, you're right, Exiv2 doesn't know the Lightroom schema yet. But that shouldn't stop you from registering the lr
prefix and adding this property with a value of the correct type anyway. Along the lines of the examples here: http://www.exiv2.org/example5.html
Andreas
Updated by Robin Mills about 7 years ago
- Status changed from Feedback to Resolved
- Assignee set to Robin Mills
- Target version set to 0.25
Thank you Alan for the patch. You're as helpful as always. I've submitted this r3384. Other notes: http://dev.exiv2.org/boards/3/topics/1847
Updated by Alan Pater over 6 years ago
- File lr.typo.patch lr.typo.patch added
On re-testing my previous patch, I came across a couple of functionally non-trivial typos. Please update with the attached patch.
"hierarchicalsubject" should have been "hierarchicalSubject"
"privatertkinfo" should have been "privateRTKInfo"
Updated by Robin Mills over 6 years ago
- Status changed from Resolved to Assigned
Thanks, Alan. I've changed the status to "Assigned" to ensure this gets my attention. I'll submit your patch in the next few days.
Updated by Alan Pater over 6 years ago
Thomas, Robin, can we test this one as well? It's a tiny change.
Updated by Thomas Beutlich over 6 years ago
Do you mean the two typo fixes? Patch is OK, but I cannot judge which names are "better".
Updated by Robin Mills over 6 years ago
I've lost the plot here, Alan. (it's been a very long 12-hour day on Exiv2). Do you have a test JPG to be added to the test suite?
Most of our tests simply run some exiv2 commands on one or more files. The terminal output is compared to a reference file. If the output doesn't change we say it has passed. I think this is simply about typos in the output I only need to run exiv2 -pa bug-784.jpg and add the reference file.
Updated by Alan Pater over 6 years ago
- File exiv2.lr.jpg exiv2.lr.jpg added
Here goes. That attached test file has had Xmp.lr.hierarchicalSubject written by this patch to exiv2. The correct spelling of the XMP property is Xmp.lr.hierarchicalSubject
I have included a copyright notice putting the image in the public domain. That means to me that anyone can do whatever they like with the image.
The Xmp.lr.privateRTKInfo property does not appear in this image. If I understand correctly, it is a internal property used in Adobe products. My tests with a trial version of Lightroom don't show that property. I've included it in the patch for completeness and because exiftool does. Just don't ask me what it is for! ;-)
Updated by Alan Pater over 6 years ago
As far as "which names are better", "hierarchicalSubject" and "privateRTKInfo" agree with exiftool and Adobe products. If the capitalization is different, the data is written to redundant and different properties. "hierarchicalSubject" is correct. "hierarchicalsubject" is wrong.
Updated by Alan Pater over 6 years ago
- File exiv2.lr.jpg exiv2.lr.jpg added
Same sample file after opening and adding tags in Lightroom.
Lightroom read the hierachical subject tags written by exiv2. Adding another hierarchical tag through Lightroom works correctly.
$ exiv2 -pa exiv2.lr.jpg | grep Xmp.lr
Xmp.lr.hierarchicalSubject XmpBag 2 root0|next1|next2, root|1st|2nd
The "root0|next1|next2" hierarchy was added by exiv2. "root|1st|2nd" was added by Adobe Lightroom.
My trial version of Lightroom did NOT add the Xmp.lr.privateRTKInfo property.
Updated by Alan Pater over 6 years ago
Also regarding the typo and getting back to the title of this report: "Writing Xmp.lr.hierarchicalSubject writes wrong datatype"
Without the typo fix, that issue remains. Xmp.lr.hierarchical*S*ubject will write the wrong datatype. Xmp.lr.hierarchical*s*ubject will write the correct datatype, but will not be compatible with Adobe and other applications.
Updated by Robin Mills over 6 years ago
- Assignee changed from Robin Mills to Alan Pater
Updated by Alan Pater over 6 years ago
- File lightroom.diff lightroom.diff added
- Assignee changed from Alan Pater to Robin Mills
Apologies for being so confusing this report. We still need this patch with the correct capitalization applied.
Updated by Robin Mills over 6 years ago
Alan
I've applied your patch (lightroom.diff), built it and ran the test suite. Nothing seems to have changed. So I've taken a fresh copy of the code and built it. Still nothing has changed. Conclusion: my test is ineffective. However I've submitted the change: r3644
This is the output (both before and after the change):
964 rmills@rmillsmbp:~/gnu/exiv2/trunk/test $ exiv2 -px data/exiv2-bug784.jpg Xmp.dc.format XmpText 10 image/jpeg Xmp.dc.rights LangAlt 1 lang="x-default" Public Domain. Do whatever you like with this image Xmp.dc.subject XmpBag 6 1st, 2nd, next1, next2, root, root0 Xmp.xmpMM.DocumentID XmpText 32 004D48F936062EF5085A81BF96D4C494 Xmp.xmpMM.OriginalDocumentID XmpText 32 004D48F936062EF5085A81BF96D4C494 Xmp.xmpMM.InstanceID XmpText 44 xmp.iid:f74f0d02-e921-134e-8107-1dda17aad853 Xmp.xmpMM.History XmpText 0 type="Seq" Xmp.xmpMM.History[1] XmpText 0 type="Struct" Xmp.xmpMM.History[1]/stEvt:action XmpText 5 saved Xmp.xmpMM.History[1]/stEvt:instanceID XmpText 44 xmp.iid:f74f0d02-e921-134e-8107-1dda17aad853 Xmp.xmpMM.History[1]/stEvt:when XmpText 25 2015-03-24T20:35:55-05:00 Xmp.xmpMM.History[1]/stEvt:softwareAgent XmpText 39 Adobe Photoshop Lightroom 4.4 (Windows) Xmp.xmpMM.History[1]/stEvt:changed XmpText 9 /metadata Xmp.xmp.MetadataDate XmpText 25 2015-03-24T20:35:55-05:00 Xmp.crs.RawFileName XmpText 12 exiv2.lr.jpg Xmp.lr.hierarchicalSubject XmpBag 2 root0|next1|next2, root|1st|2nd 965 rmills@rmillsmbp:~/gnu/exiv2/trunk/test $Unfortunately, I don't know anything about this part of the code. I really haven't a clue what this is about!
Updated by Alan Pater over 6 years ago
The difference is when one does not include the xmp type (XmpBag) when writing this property.
r3643 results in the wrong type (XmpText)
~$ exiv2 -M"add Xmp.lr.hierarchicalSubject root|1st|2nd|3rd|4th|5th" exiv2.lr.r3643.jpg
Xmp.lr.hierarchicalSubject XmpText 24 root|1st|2nd|3rd|4th|5thUNLESS one is explicit about the type.
~$ exiv2 -M"add Xmp.lr.hierarchicalSubject XmpBag root|1st|2nd|3rd|4th|5th" exiv2.lr.r3643.jpg
Xmp.lr.hierarchicalSubject XmpBag 1 root|1st|2nd|3rd|4th|5th
r3644 results in the correct type (XmpBag) without have to be explicit.
~$ exiv2 -M"add Xmp.lr.hierarchicalSubject root|1st|2nd|3rd|4th|5th" exiv2.lr.r3644.jpg
Xmp.lr.hierarchicalSubject XmpBag 1 root|1st|2nd|3rd|4th|5th
Updated by Robin Mills over 6 years ago
Right. I'll update the test to
exiv2 -M"add Xmp.lr.hierarchicalSubject root|1st|2nd|3rd|4th|5th" exiv2.lr.r3643.jpg exiv2 -px exiv2.lr.r3643.jpgI call a test like this a "Test regression detector" because the test will report an exception if the fix disappears.
I'll do that now and then I'm off to bed. It's been another 12 hour day on Exiv2. r3645
Updated by Alan Pater over 6 years ago
- Status changed from Assigned to Resolved
Yes, it works as expected now. Thanks!
Issue: #784. Thanks to Alan for the patch. See topic: http://dev.exiv2.org/boards/3/topics/1847