copy exif model and lensmodel to iptc keywords

Started by eliz, September 15, 2017, 05:00:44 PM

Previous topic - Next topic

eliz

hello,
i want to copy the exif camera Model and the LensModel to IPTC:keywords . i want those two values to be comma separated.

i have tried something like this:
exiftool.exe "-Keywords+<Model" -Keywords+=,  "-Keywords+<LensType" IMG_1.jpg
this only add only the last one (lenstype)

OS: Windows 7/Dos

StarGeek

Keywords aren't saved as comma separated values.  Each keyword is complete and separate entry.  Programs such as Lightroom will show them as comma separated for ease of display, but that's not how they are stored.  So unless you wanted a single keywords of "Model, LensType", then you don't need to worry about it. 

The second problem had me a bit stumped but the answer is under tagsfromfile note #5.

Try this command:
exiftool -addTagsFromFile @ "-Keywords+<Model" "-Keywords+<LensType" IMG_1.jpg
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

eliz

i have tested now and it's seems the software I will use ( Piwigo ) allow the IPTC keywords to be separated using return/newline character (like exiftool is adding them).
so it's fine.

now I have another problem. I want to add some LensModel to my files exif based on Lens FocalLenght and Camera Model
i have read this thread
https://exiftool.org/forum/index.php/topic,3411.msg15399.html
i have tried something like this

exiftool -if "$EXIF:FocalLength# eq '400'" "$EXIF:Model eq 'Canon EOS-1D Mark III'" -LensType#=172 -LensModel="EF400mm f/5.6L USM" -ext jpg -r * -P -v0
but this not seems to work. all the files that gave 400 focal lenght are updated, not only those made by Canon 1D mark III. so the second rule is not taken into consideration.

so the question is how do I add multiple IF rules?
IF (rule1) AND (rule2) do ...

StarGeek

Quote from: eliz on September 16, 2017, 12:45:55 PM
i have tested now and it's seems the software I will use ( Piwigo ) allow the IPTC keywords to be separated using return/newline character (like exiftool is adding them).

Just to clarify, each keywords is saved as a completely separate entry.  You can include a carriage return or new line in the keyword if you want (though that makes the keywords a PITA to deal with, having dealt with that situation before).  It's not saved as a string with separators.

Quoteso the question is how do I add multiple IF rules?
IF (rule1) AND (rule2) do ...

Exactly as you show here.  You use AND.  Additionally, you surround the whole thing in quotes, not separate them.
-if "$EXIF:FocalLength# eq '400' and $EXIF:Model eq 'Canon EOS-1D Mark III'"

Also, something to watch out for.  eq is a string comparison operator, but you're using it to compare two numbers, which would normally be a numeric comaprison =.  It'll work fine in this case but there may be cases were it will backfire on you.  It's a mistake I made too often.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

eliz

Quote from: StarGeek on September 16, 2017, 01:07:26 PM
Exactly as you show here.  You use AND.  Additionally, you surround the whole thing in quotes, not separate them.
-if "$EXIF:FocalLength# eq '400' and $EXIF:Model eq 'Canon EOS-1D Mark III'"
Also, something to watch out for.  eq is a string comparison operator, but you're using it to compare two numbers, which would normally be a numeric comaprison =.  It'll work fine in this case but there may be cases were it will backfire on you.  It's a mistake I made too often.
thanks