config file tag definition for IPTC KeyWords style tag

Started by calberga, November 22, 2015, 10:54:27 AM

Previous topic - Next topic

calberga

I have attempted to create a new IPTC tag which behaves like the KeyWords tag.  I copied the "Format" value from that shown for KeyWords, i.e.

198 => {
           Name => 'People',
           Format => 'string[0,64]+',
        },

(This is buried in a list of other custom tags.)

but this gives a syntax error.

What should the Format be defined as?

Phil Harvey

Just drop the "+" sign and all should be good.

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

calberga

Thanks, I had blindly copied from the "writable" column in the IPTC tag list, assuming that the + was needed to allow adding multiple items to the value.  I searched for the syntax of the "Format" line in the definitions, but couldn't find it.  Is this documented someplace?

Phil Harvey

The best documentation for this are the examples of tag definitions in the ExifTool source code (for example, here on sourceforge).  The actual documentation is in lib/Image/ExifTool/README, but it isn't detailed enough to cover all the nuances of the Formats for all metadata types.

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

calberga

Unfortunately, I can't seem to make it work.  I'm trying to move all the "face" information (in my own crazy format) from the KeyWords tag to the custom defined tag People, so I can use KeyWords for other things and not have to sort through them to find the "faces".  I hoped that I could just run a recursive application of -People=$KeyWords.  That didn't work, so I tried adding -sep ", " since that seemed to be what the value of -Keywords was.  That still didn't work. 

I've been setting the KeyWords using and args file containing lines such as:


-Keywords=("Alberga, Emma C." 0 13926 43212 65535)
D:/P/Working/00060637.jpg
-execute
D:/P/Working/00060637.jpg
-execute
-Keywords=("Alberga, Emma C." 54185 12237 61944 19609):("Alberga, Katherine Ansell" 40975 10445 46939 16077)
D:/P/Working/00060638.jpg
-execute
D:/P/Working/00060638.jpg
-execute
-Keywords=("Alberga, Emma C." 15973 40396 22467 45772):("Alberga, Katherine Ansell" 46352 35327 53891 41523):("Morikado, Logan" 8136 39833 15301 45721)
D:/P/Working/00060639.jpg
-execute


invoked by:

exiftool -@ "D:/P/X/D-r-kw-updates.args" -common_args -L -V0 -P -overwrite_original -sep ":"

which works just fine. 

But I haven't figured out anything that will copy the data into the new tag.  Any variation that I've tried on:

exiftool  -ext jpg -charset cp1252 "-People<$KeyWords" -overwrite_original -sep ", " -F -r -P -v0 "D:/Working/"

results in data truncated to 64 bytes.  So is there a way to define a customn tag that acts the way KeyWords does?


Phil Harvey

#5
Quote from: calberga on November 22, 2015, 09:43:48 PM
So is there a way to define a customn tag that acts the way KeyWords does?

Yes.  Just do exactly like the Keywords definition in the source code (see the link I posted).  Did you make it a "List"-type tag?

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

calberga

I apologize for hesitating to look at the source code.  I was daunted by the idea of having to wade through a language the syntax of which I was unfamiliar.  But with your prodding I see that it is quite clear.  Thank you for your patience.