Skip to content

Commit 0c586e5

Browse files
authored
Fix encode_xmp for aliased metadata names
Signed-off-by: Qi-fly <72260719+Qi-fly@users.noreply.github.com>
1 parent d21d027 commit 0c586e5

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/libOpenImageIO/xmp.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,14 @@ class XMPtagMap {
228228
XMPtagMap(const XMPtag* tag_table)
229229
{
230230
for (const XMPtag* t = &tag_table[0]; t->xmpname; ++t) {
231-
std::string lower(t->xmpname);
232-
Strutil::to_lower(lower);
233-
m_tagmap[lower] = t;
231+
std::string lower_xmp(t->xmpname);
232+
Strutil::to_lower(lower_xmp);
233+
m_tagmap[lower_xmp] = t;
234+
if (t->oiioname && t->oiioname[0]) {
235+
std::string lower_oiio(t->oiioname);
236+
Strutil::to_lower(lower_oiio);
237+
m_tagmap[lower_oiio] = t;
238+
}
234239
}
235240
}
236241

@@ -614,7 +619,8 @@ gather_xmp_attribs(const ImageSpec& spec,
614619
// name, where the xmp name is in the right category.
615620
const XMPtag* tag = xmp_tagmap_ref().find(p.name());
616621
if (tag) {
617-
if (!Strutil::iequals(p.name(), tag->oiioname))
622+
if (!Strutil::iequals(p.name(), tag->oiioname)
623+
&& !Strutil::iequals(p.name(), tag->xmpname))
618624
continue; // Name doesn't match
619625
if (tag->special & Suppress) {
620626
break; // Purposely suppressing

0 commit comments

Comments
 (0)