Closed leifniem closed 8 months ago
The problem has been fixed with commit 942c6e1e633725ea8dc4991c0e062524e4825060.
To parse tag values as number/boolean instead of string, you also need to extend the xmpTagTypeMap
with vendor-specific presets, see example https://github.com/fuweichin/image-info-extractor/blob/main/examples/image-info-extractor.js#L8.
B.T.W. Those XMP tagTypeMap presets are collected from https://exiftool.org/TagNames/XMP.html, with help of DevTools Console script,
let extractFromTable = (tbody, prefix) => {
let items = [];
[...tbody.rows].forEach((tr,i)=>{
if(i===0){
return;
}
let {cells} = tr;
let tagName = cells[0].textContent;
let writable = cells[1].textContent;
let m = /^(integer|boolean|real|rational)/.exec(writable);
if(!m) {
return;
}
let tagType = m[1];
if(writable.endsWith('+')) {
tagType+='[]';
}
items.push(` '${prefix}:${tagName}': '${tagType}',`);
});
return items;
}
// console.log(extractFromTable(temp1, 'crs').join('\n'))
Try to make your own if you have further needs.
Thanks a lot, will do :)
It seems that your helper console script ignores string
values of the table, i don't know if that is by accident or intentional.
xmpTagTypeMap
is designed to specify types of non-string XMP tags when parsing, by default an XMP tag will be parsed as string.
Hi,
i recently used your library in one of my projects and was noticing that nested RDF structs do not get parsed correctly.
For example the following raw XMP data:
results in the following object:
Another example would be the Look Struct, which just appears as
null
in the parsed version.