Hello,
I am wondering if it is possible to create multiple namespaces and associated tags in the .Exiftool_config file? I unfortunately need to write custom tags to multiple namespaces for a compatibility issue with some other software. I can get a single namespace and associated tags to work great, but I cannot successfully combine multiple sets of namespaces and tags into a single file. I am probably doing something dumb, but I am not sure what it is....
The config (as it currently is) file is as follows:
%Image::ExifTool::UserDefined::ns_1 = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-ns_1', 2 => 'Image' },
NAMESPACE => { 'ns_1' => 'http://mydomain/ns_1' },
WRITABLE => 'string',
tag_one => { },
tag_two => { },
tag_three => { },
pumpkinpie => { },
);
# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
# new XMP namespaces (ie. XXX) must be added to the Main XMP table:
'Image::ExifTool::XMP::Main' => {
ns_1 => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::ns_1',
},
},
},
);
%Image::ExifTool::UserDefined::ns_2 = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-ns_2', 2 => 'Image' },
NAMESPACE => { 'ns_2' => 'http://mydomain/ns_2' },
WRITABLE => 'string',
abc_one => { },
donuts => { },
abc_two => { },
spaceship => { },
unknown => { },
);
# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
# new XMP namespaces (ie. XXX) must be added to the Main XMP table:
'Image::ExifTool::XMP::Main' => {
ns_2 => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::ns_2',
},
},
},
);
1; #end
When I try to write to write to any of the tags in ns_1 I get an error that states:
computer:~ jesse$ exiftool -XMP:pumpkinpie="foo" sampleimage.tif
Warning: Tag 'pumpkinpie' does not exist
Nothing to do.
But...
computer:~ jesse$ exiftool -XMP:donuts="foo" sampleimage.tif
1 image files updated
ns_2 tags work just fine.
Any thoughts or suggestions would be most greatly appreciated.
I am on a Mac, using Exiftool 8.77, but I suspect that my shoddy config file is the source of the problem.
This is a common problem for non-programmers. Your 2nd definition is overriding the 1st.
Try this instead:
%Image::ExifTool::UserDefined::ns_1 = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-ns_1', 2 => 'Image' },
NAMESPACE => { 'ns_1' => 'http://mydomain/ns_1' },
WRITABLE => 'string',
tag_one => { },
tag_two => { },
tag_three => { },
pumpkinpie => { },
);
%Image::ExifTool::UserDefined::ns_2 = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-ns_2', 2 => 'Image' },
NAMESPACE => { 'ns_2' => 'http://mydomain/ns_2' },
WRITABLE => 'string',
abc_one => { },
donuts => { },
abc_two => { },
spaceship => { },
unknown => { },
);
# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
# new XMP namespaces (ie. XXX) must be added to the Main XMP table:
'Image::ExifTool::XMP::Main' => {
ns_1 => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::ns_1',
},
},
ns_2 => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::ns_2',
},
},
},
);
1; #end
- Phil
Thanks Phil! Now it works like a charm.
-Jesse
I must be missing something. I don't see any difference between the OP's config and Phil's suggested modifications. I'm trying to add a custom namespace of my own, and if I wasn't on an iPad and my config file on a Net-less PC, I'd paste what I have here and now.
I'll be back soon to start a new thread on this topic, for sure. As a longtime Exiv2 user, the idea of including a custom namespace without knowing any C or having to use Andreas' reg command appeals greatly.
BZT
In the original post, %Image::ExifTool::UserDefined is defined twice. Once containing ns_1 and the second time with ns_2. The second one will override the first definition.
I changed it so that both ns_1 and ns_2 are defined in a single %Image::ExifTool::UserDefined hash (and inside the same 'Image::ExifTool::XMP::Main' definition).
- Phil
Hi,
Picking up on this question since I have detected some kind of issue here.
I have tested this with Exiftool version 9.04 and 9.58 on OSX 10.7.5.
I am using one hash to register two different name spaces where both the NS's have a property named Descrizione
When trying to update the two Descrizione with different values, the result file will have the same value.
For convenience here are configuration files etc for test.
Original JPG file: https://www.dropbox.com/s/3s6s6z0ty6n2d1q/test_original_file.jpg (https://www.dropbox.com/s/3s6s6z0ty6n2d1q/test_original_file.jpg)
Configuration file: https://www.dropbox.com/s/7uhc4qrnmm8h61z/configFile.txt (https://www.dropbox.com/s/7uhc4qrnmm8h61z/configFile.txt)
XMP to insert: https://www.dropbox.com/s/qfucz4u5sg4u0zp/allXMP.xml (https://www.dropbox.com/s/qfucz4u5sg4u0zp/allXMP.xml)
Script file (OSX): https://www.dropbox.com/s/tcgr12r2onr1l6x/script.sh (https://www.dropbox.com/s/tcgr12r2onr1l6x/script.sh)
Result file: https://www.dropbox.com/s/jv5dlnewhh8une8/test_result_file.jpg (https://www.dropbox.com/s/jv5dlnewhh8une8/test_result_file.jpg)
The configuration file is as follows (link to file above)
%Image::ExifTool::UserDefined::nsrcsp = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-nsrcsp', 2 => 'Image' },
NAMESPACE => { 'nsrcsp' => 'http://ns.own.portal/' },
WRITABLE => 'string',
Descrizione => {},
Provenienza => {},
);
%Image::ExifTool::UserDefined::nsrcs = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-nsrcs', 2 => 'Image' },
NAMESPACE => { 'nsrcs' => 'http://ns.own.bridge/' },
WRITABLE => 'string',
Prezzo => {},
Anagrafica => {},
Tipologia => {},
Descrizione => {},
);
%Image::ExifTool::UserDefined = (
'Image::ExifTool::XMP::Main' => {
nsrcsp => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::nsrcsp',
},
},
nsrcs => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::nsrcs',
},
},
},
);
And the XMP I am trying to insert in this example is the following (link to file above)
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:nsrcsp="http://ns.own.portal/" nsrcsp:Descrizione="Edited portal value"/>
<rdf:Description xmlns:nsrcs="http://ns.own.bridge/" nsrcs:Descrizione="Edited bridge value"/>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
So my wanted output should have different values in the portal and bridge NS's but both the portal AND bridge will get the value Edited bridge value.
I can't seem to find where this go wrong, any pointer?
Kind regards, Joakim
Hi Joakim,
Your problem is that you need to specify the family 1 group when writing. In your script, you have "-all>xmp:all" (which specifies the family 0 group of XMP). You should probably add "-xmp:all>all:all" after this if you want to preserve the namespaces of the XMP tags.
- Phil
Edit: You need to think carefully about what you want. My suggestion will still duplicate the Descrizione tag to both namespaces if it only existed in 1 previously (due to the "-all>xmp:all" argument).
Thank you, that made the difference, thanks!
I will do some more extensive tests with various original values and editing but now I am on the right track to know where the initial error was, thank you.