append LensID tag into keywords field?

Started by Archive, May 12, 2010, 08:54:22 AM

Previous topic - Next topic

Archive

[Originally posted by cobalt on 2008-07-15 01:49:56-07]

Code:
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 keywords 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 LensID and Model tags to the keywords while keeping the other keywords as well. Is this possible using 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

Archive

[Originally posted by bogdan on 2008-07-15 05:17:03-07]

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

Archive

[Originally posted by exiftool on 2008-07-15 11:07:45-07]

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:

Code:
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

Archive

[Originally posted by exiftool on 2008-07-15 11:19:27-07]

Somehow the - went missing from -d
on the first line of my argfile example.

Archive

[Originally posted by cobalt on 2008-07-15 11:53:57-07]

Code:
Thank you very much for the responses to my query. The copyright tag is now added correctly but I still 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 overwritten. Anyway, I have another way around this in the script I'm preparing but this would be more elegant 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

Archive

[Originally posted by exiftool on 2008-07-15 13:44:06-07]

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

Archive

[Originally posted by cobalt on 2008-07-15 14:37:08-07]

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 Smiley.

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

Archive

[Originally posted by exiftool on 2008-07-17 11:32:53-07]

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. Smiley

- Phil