Issue with adding Custom tags, which contains special characters

Started by johncarter, November 28, 2014, 04:26:31 AM

Previous topic - Next topic

johncarter

Hi,

I am trying to add custom metadata to xmp namespace. It is not working if metadata tag contains special characters

console output:
Array found where operator expected at XMP_METADATA.cfg line 4, at end of line
Scalar found where operator expected at XMP_METADATA.cfg line 4, near "@#$%"
        (Missing operator before $%?)
syntax error at XMP_METADATA.cfg line 4, near "Test@*"
Warning: Tag 'Test@*!@#$%()PREFIX' does not exist
Nothing to do.


Commands used:
exiftool -config XMP_METADATA.cfg -xmp-xmp:Test@*!@#$%()PREFIX=TestValue InputImage.jpg


Contents of XMP_METADATA.cfg:

%Image::ExifTool::UserDefined = (
'Image::ExifTool::XMP::xmp' => {
Test@*!@#$%()PREFIX => { },
},
);
#end


Any insight how to insert custom tags, which contains special characters.


Phil Harvey

Try putting single quotes around the XMP property name:

'Test@*!@#$%()PREFIX' => { },

It might also be useful to provide a tag name, because the automatically-generated name might not be obvious:

'Test@*!@#$%()PREFIX' => { Name => 'TestPrefix' },

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

johncarter

Hi,

Single quotes around the XMP property name not worked, it's giving below error from command line

Warning: Tag 'Test@*!@#$%()PREFIX' does not exist
Nothing to do.



Config file:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::XMP::xmp' => {
HANES_MC_PREFIX => { },
'Test@*!@#$%()PREFIX' => { },
},
);
#end

Phil Harvey

This is what I get.

Note that some of these characters are illegal in an XMP property name, so the resulting XMP is actually not valid:

> cat t.config
%Image::ExifTool::UserDefined = (
'Image::ExifTool::XMP::xmp' => {
HANES_MC_PREFIX => { },
'Test@*!@#$%()PREFIX' => { Name => 'TestPrefix' },
},
);
#end

> exiftool -config t.config -testprefix=hello a.xmp
    1 image files created

> cat a.xmp
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 9.76'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about=''
  xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
  <xmp:Test@*!@#$%()PREFIX>hello</xmp:Test@*!@#$%()PREFIX>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>


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