Bug #784

Writing Xmp.lr.hierarchicalSubject writes wrong datatype

Added by Lucas Beeler almost 6 years ago. Updated almost 2 years ago.

Status:ClosedStart date:02 Aug 2011
Priority:NormalDue date:
Assignee:Alan Pater% Done:

100%

Category:xmp
Target version:0.25

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. :-(

784.diff Magnifier - Add LR support (2.98 KB) Alan Pater, 29 Oct 2014 22:17

lr.typo.patch Magnifier - Typo patch (902 Bytes) Alan Pater, 15 Mar 2015 02:48

exiv2.lr.jpg - LR Hierarchical Subject written by exiv2 (11.9 KB) Alan Pater, 24 Mar 2015 23:33

exiv2.lr.jpg (13.3 KB) Alan Pater, 25 Mar 2015 01:42

lightroom.diff Magnifier - hierarchicalSubject (936 Bytes) Alan Pater, 25 Mar 2015 21:35


Related issues

Related to Exiv2 - Feature #1040: MWG-KW schema Closed 12 Mar 2015

Associated revisions

Revision 3384
Added by Robin Mills over 2 years ago

Issue: #784. Thanks to Alan for the patch. See topic: http://dev.exiv2.org/boards/3/topics/1847

Revision 3643
Added by Robin Mills about 2 years ago

#784 and #1040. Test regression detector.

Revision 3644
Added by Robin Mills about 2 years ago

#784. Change requested by Alan (typos).

Revision 3645
Added by Robin Mills about 2 years ago

#784 Modified the test regression detector submitted in r3643. Thank You Alan for your explanation.

Revision 3656
Added by Alan Pater about 2 years ago

#784 doc template for lr schema

History

#1 Updated by Andreas Huggel almost 6 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

#2 Updated by Alan Pater over 2 years ago

#3 Updated by Robin Mills over 2 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

#4 Updated by Alan Pater about 2 years ago

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"

#5 Updated by Robin Mills about 2 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.

#6 Updated by Alan Pater about 2 years ago

Thomas, Robin, can we test this one as well? It's a tiny change.

#7 Updated by Thomas Beutlich about 2 years ago

Do you mean the two typo fixes? Patch is OK, but I cannot judge which names are "better".

#8 Updated by Robin Mills about 2 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.

#9 Updated by Alan Pater about 2 years ago

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! ;-)

#10 Updated by Alan Pater about 2 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.

#11 Updated by Alan Pater about 2 years ago

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.

#12 Updated by Alan Pater about 2 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.

#13 Updated by Robin Mills about 2 years ago

  • Assignee changed from Robin Mills to Alan Pater

Submitted: r3543

Alan:
I've reported my action in #1040. I hope I've got this correct. I've assigned this issue to you. If you're happy, mark it (and #1040) as Resolved. If you're not - assign them back to me for further attention.

#14 Updated by Alan Pater about 2 years ago

  • File lightroom.diffMagnifier 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.

#15 Updated by Robin Mills about 2 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!

#16 Updated by Robin Mills about 2 years ago

  • Assignee changed from Robin Mills to Alan Pater

#17 Updated by Alan Pater about 2 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|5th
UNLESS 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

#18 Updated by Robin Mills about 2 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.jpg
I 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

#19 Updated by Alan Pater about 2 years ago

  • Status changed from Assigned to Resolved

Yes, it works as expected now. Thanks!

#20 Updated by Alan Pater about 2 years ago

  • % Done changed from 0 to 100

#21 Updated by Andreas Huggel almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux