Updating Lens tag fails using -if option

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

Previous topic - Next topic

Archive

[Originally posted by msbc on 2009-11-12 02:11:54-08]

Hi,

I'm updating some NEF's to add Lens data after using a manual focus lens. I'm also using the -if option to only process NEF's missing this data in a folder.

I've found that the following command works as expected:
Code:
exiftool -P -Lens="21mm f/2.8" -MaxApertureValue="2.8" -FNumber=11 -FocalLength=21  Zeiss.NEF
Then, executing
Code:
exiftool -Lens -MaxApertureValue -FNumber -FocalLength -ext NEF .
I get
Code:
======== ./Zeiss.NEF
Lens                            : 21mm f/2.8
Max Aperture Value              : 2.8
F Number                        : 11.0
Focal Length                    : 21.0 mm
But, if I use an -if option as follows (FNumber does equal 0 for these files):

Code:
exiftool -P -Lens="21mm f/2.8" -MaxApertureValue="2.8" -FNumber=11 -FocalLength=21
-n -if '$FNumber eq 0' Zeiss.NEF
Then the result is:
Code:
======== ./Zeiss.NEF
Lens                            : 0mm f/0
Max Aperture Value              : 2.8
F Number                        : 11.0
Focal Length                    : 21.0 mm
Three tags are updated but Lens is not.

exiftool 7.99 on OSX 10.5.8

Archive

[Originally posted by exiftool on 2009-11-12 15:46:20-08]

The problem is simple, but maybe not obvious:

If you use the -v2 option you will see the following
message (among lots of others):

Code:
"Not enough values specified (4 required) for Nikon:Lens"

It is the -n option that is causing you the problem,
not -if.  The Nikon:Lens tag must be converted to
numerical form when writing, and the -n disables
this conversion so the tag is not written because the input
string is in the wrong format.

Please let me know if you have any more problems.

- Phil

P.S. You get points for trying this with the most recent ExifTool
version before posting this.

Archive

[Originally posted by msbc on 2009-11-12 21:24:39-08]

Phill

Can you help me with the -if part then. If I simply remove -n the condition fails.

Output from exiftool -FNumber Zeiss.NEF:
Code:
Mark:Testing$ exiftool -FNumber Zeiss.NEF
F Number                        : 0.0
but the condition fails with 0.0.

Could you also enlighten me what the 4 required values for Nikon:Lens are?

Archive

[Originally posted by exiftool on 2009-11-13 11:38:59-08]

I'm sorry, I should have thought of this.
You can either do a string compare:

Code:
-if '$fnumber eq "0.0"'

or a numerical compare:

Code:
-if '$fnumber == 0'

or you could do what you were originally doing but use
"#" to return the numerical value of this tag only (instead
of using -n which applies to all tags):

Code:
-if '$fnumber# eq 0'

Take your choice. Smiley

- Phil