Thread

Posted on Tue Jul 15 04:49:56 2008 by cobalt
append LensID tag into keywords field?
This is the command line: exiftool file.jpg -@ ARG_FILE the ARG_FILE looks like this: -keywords=this is the test1 -keywords=six.point.three test2 -keywords=test3 -keywords=test32, $lensid -d %Y -copyright'<Copyright $createdate, Patrick J. Finerty, Jr.' -xmp:city=Toronto -xmp:location=hell on earth -xmp:country=Canada -xmp:reuseallowed=No I've tried various incarnations of this file but the only way I can get the LensID copied to the ke +ywords tag is by specifying it this way in the ARG_FILE -keywords<$lensid Unfortunately, this erases all of my other keywords. Any suggestions? I'm just want to append the L +ensID and Model tags to the keywords while keeping the other keywords as well. Is this possible us +ing the -TagsFromFile feature (that is implicit in the above)? Also, the copyright statement is not being added with this method either but that syntax works fine + on the command line
Direct Responses: 8305 | 8307 | Write a response
Posted on Tue Jul 15 08:17:03 2008 by bogdan in response to 8304
Re: append LensID tag into keywords field?
For tags, which allows multiple values (such as IPTC:keywords, or XMP:subject), you can use:
-keywords=first (delete all values there might be, and insert new value)
-keywords+=second (append value -now you have keywords: first, second)
-keywords-=first (delete value "first" from keywords)

Greetings,
Bogdan
Write a response
Posted on Tue Jul 15 14:07:45 2008 by exiftool in response to 8304
Re: append LensID tag into keywords field?
I'll answer your 2nd question first: You can only put one argument per line in the argfile, so the line with the -d option needs to be split up like this:

d %Y -copyright<Copyright $createdate, Patrick J. Finerty, Jr.

Also, you don't use quotes in the argfile.

As for the -tagsfromfile erasing all other items in the list. Yes, this is by design, but I may have to change this in a future release. The reason I did it this way was to prevent lists from being duplicated when copying all tags from file containing two list-type tags with the same name, but this side-effect is proving to be a problem. Currently, the only way around this is to add the lensid to the list with "+<" after writing the other values.

- Phil
Direct Responses: 8308 | 8309 | Write a response
Posted on Tue Jul 15 14:19:27 2008 by exiftool in response to 8307
Re: append LensID tag into keywords field?
Somehow the - went missing from -d on the first line of my argfile example.
Write a response
Posted on Tue Jul 15 14:53:57 2008 by cobalt in response to 8307
Re: append LensID tag into keywords field?
Thank you very much for the responses to my query. The copyright tag is now added correctly but I s +till cannot append the Lens ID using "+<". It simply overwrites the previous values. I find that I + do not need to use "+=" for the keywords, they are all added fine with the syntax shown below as +long as the line containing $lensid is absent. When it is present the previous values are overwrit +ten. Anyway, I have another way around this in the script I'm preparing but this would be more ele +gant than my hack. -keywords=this is the test1 -keywords=six.point.three test2 -keywords=test3 -keywords=test32 -keywords+<$lensid -d %Y -copyright<Copyright $createdate, Patrick J. Finerty, Jr. -xmp:city=Toronto -xmp:location=hell on earth -xmp:country=Canada -xmp:reuseallowed=No
Direct Responses: 8311 | Write a response
Posted on Tue Jul 15 16:44:06 2008 by exiftool in response to 8309
Re: append LensID tag into keywords field?
Sorry, when I said "after writing other values", I meant in a separate command. Currently, exiftool has the following limitations:

1) -tagsfromfile @ tags are set after all other tags on the command line. (Note this is not the case for -tagsfromfile FILE.)

2) Copying a tag with -tagsfromfile clears any existing new values that you are writing.

So there are 2 ways around this:

A) Copy the tags into an existing list in a separate command using "+<".

B) Specify a filename for -tagsFromFile and copy the -tagsfromfile tags before writing other tags on the command line. Then the list will still be reset when you copy the tags, but you can add the fixed-value items afterward.

I hope this makes sense.

I am working on an idea of implementing a -addTagsFromFile option to allow tags to be copied without overwriting existing new values.

This whole topic is a bit confusing for some, because of the difference between overwriting existing new values and overwriting existing original values in the file. You haven't fallen prey to this confusion, but I'm sure that others will if I add a -addTagsFromFile option so I am trying to work out how to best deal with this. Any suggestions are welcome.

- Phil
Direct Responses: 8313 | Write a response
Posted on Tue Jul 15 17:37:08 2008 by cobalt in response to 8311
Re: append LensID tag into keywords field?
Phil,

Thanks for your excellent support (and tool). Adding the Lens ID and Model sequentially as you described works like a charm (I just made two separate one-line arg files for that and run them one after another). Since I'm scripting this all it doesn't cost me anything to add those lines separately (well, not compared to converting ~20 MB RAW files :).

As for how to implement a copy mechanism, I'm not really sure. I think it would be a great feature but, as you mentioned, the distinction between 'existing new values' and 'existing original values' is not straightforward for everyone (possibly including me!).

Thanks again, -patrick
Direct Responses: 8343 | Write a response
Posted on Thu Jul 17 14:32:53 2008 by exiftool in response to 8313
Re: append LensID tag into keywords field?
There you go. Version 7.37 (released yesterday) adds a -addTagsFromFile option.

I've attempted to avoid confusing people with the new option by burying the documentation deep enough that nobody will ever find it unless they really need it. :)

- Phil
Write a response