Author Topic: Commands for writing lens aperture, f-stop and focal length?  (Read 12049 times)

hening

  • Jr. Member
  • **
  • Posts: 14
Commands for writing lens aperture, f-stop and focal length?
« on: October 06, 2013, 01:10:06 PM »
Please could somebody specify the commands to write the following data into the exif data of all the images in a folder:

focal length
max aperture value (of lens)
aperture value (aka f-stop, f-number)

Values for the above tags are given incorrectly, because I use adapted manual focus lenses.

For Focal Length, I find 3 entrances:

1-Focal Length: 50.0 mm
2-Focal Length In 35 mm Format: 49 mm
3-Focal Length: 50.0 mm (35 mm equivalent: 49.0 mm)

In this case, the correct figure is:

35 mm (35 mm equivalent: 35 mm)

If I succeed changing the primary focal length, will the equivalent be changed automatically, or need I specify the 3 different tags in the command? How can Exiftool see the difference between tags #1 and 3?

Also for f-stop, I find 3 different entries:

F Number: 0
Aperture Value: inf
Aperture: inf

And at last, there is an entrance
Lens: 0.0 mm (35 mm equivalent: 0.0 mm)

So what shall I type into Exiftool to change this mess into something that tells the subsequent software:"Focal length 35 mm, 35 mm equivalent = 35 mm, max lens aperture f/2.8, f-stop used f/8.0" ??

Then there is Field Of View, given as

Field Of View: 40.3 deg
The correct figure is 63 deg diagonal

Will this be re-calculated automatically, derived from new correct focal length? Or am I to add a command of its own? Am I to use the diagonal figure which is given in the Zeiss data sheet? Or does the system assume the long side of the image format?

Thank you! - Hening.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #1 on: October 06, 2013, 01:50:37 PM »
Hi Hening,

If I succeed changing the primary focal length, will the equivalent be changed automatically, or need I specify the 3 different tags in the command? How can Exiftool see the difference between tags #1 and 3?

Use -a -s -G1 (as per FAQ 3) when extracting to see exactly what you want to change.  The Composite tags are affected by writing the tags that they are derived from.

I think that this should give you enough to figure it out.  If not, let me know.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #2 on: October 06, 2013, 03:13:19 PM »
Hi Phil!
Thank you for this fast reply. I'll try to figure it out and come back if I can not.

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #3 on: October 06, 2013, 05:13:02 PM »
Hi again!
Here are the first questions:

exiftool -a -G1 -s
extracts the following primary (non-composite) tags of interest to me:

ExifIFD:   FNumber:0
ExifIFD:   ApertureValue:inf
EXifIFD: FocalLength: 50.0 mm
Canon:   FocalLength: 50 mm
Canon:   FocalLenght: 50 mm --Yes that tag appears twice in the same group!!
Canon:   FNumber: 0.71

From Exiftool Application Documentation/Options/Option Details/Tag Operations; Notes

"3) The maker note information is copied as a block, so it isn't affected like other information by subsequent tag assignments on the command line."
-- is the "Canon" group of tags = the maker notes block?
--does the above phrasing mean these tags can't be written?
--The ExifIFD Group contains both FNumber and ApertureValue. Is the latter the max aperture of the lens? If yes, can I write the correct figures into both tags in the f/x format?
Canon: FNumber reads 0.71. How does that translate to the usual notation of f/x? Can I write it in the latter format? Will subsequent software understand the f/x format?
Canon: What to do with the duplicate of FocalLenght ??
BTW the ExifToolVersion is given as 9.28, whereas the version downloaded and used is 9.37
That may suffice for now...

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #4 on: October 07, 2013, 07:30:33 AM »
-- is the "Canon" group of tags = the maker notes block?

Yes.  Maybe I should have suggested -G instead of -G1, and this would be obvious.

Quote
--does the above phrasing mean these tags can't be written?

No.  Individual maker notes tags may be written.  Just not created or deleted individually.

Quote
--The ExifIFD Group contains both FNumber and ApertureValue. Is the latter the max aperture of the lens?

No.  They are different representations of the same thing.

Quote
Canon: FNumber reads 0.71. How does that translate to the usual notation of f/x? Can I write it in the latter format?

ExifTool expects you to write values in the same format as they are read.  The "f/" is not stored in the file anyway, so software should be able to read it just fine if you write it as "0.71" using ExifTool.

Quote
Canon: What to do with the duplicate of FocalLenght ??

Just write "Canon:FocalLength", and both will get updated.  There is a lot of duplicate information in maker notes.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #5 on: October 07, 2013, 03:50:05 PM »
Hi again

Thank you for your answer!

> ExifTool expects you to write values in the same format as they are read.  The "f/" is not stored in the file anyway, so software should be able to read it just fine if you write it as "0.71" using ExifTool.

Hm, I'm afraid you misunderstood me. The problem is the other way round: I have no idea how "0.71" translate to the normal f/-stop notation. I would need to enter f/8. (How) can I do this? And if not, how can I convert?

Kind regards - Hening.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #6 on: October 07, 2013, 06:11:47 PM »
Hi Hening,

Good point.  I wasn't paying enough attention.  I was thinking you meant 7.1, which would make sense (f/7.1), because f/0.71 certainly doesn't -- I don't think that Canon makes a lens that fast!  There is something wrong with the way ExifTool is interpreting the Canon FNumber in this file if it shows 0.71.

To write f/8 for instance, use -fnumber=8 in the command.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #7 on: October 08, 2013, 08:37:27 AM »
Hi Phil!

Thank you for your reply!

Remaining question: What about the ExifIFD group? It shows both "FNumber" and "ApertureValue", which you say both mean the actually used f-stop. Now - what do I have to enter for "ApertureValue"? -apertureValue=8" or "-fnumber=8"? I would assume the former. But what makes me a little unsure is that the readout shows FNumber as "0", ApertureValue as "inf".

Kind regards - Hening.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #8 on: October 08, 2013, 11:27:44 AM »
Hi Hening,

You should use both -fnumber=8 and -aperturevalue=8.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #9 on: October 08, 2013, 03:10:58 PM »
Thank you!

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #10 on: November 17, 2014, 06:13:54 PM »
Hi Phil

I am making my first experiences with ExifTool, trying to write focal length and f-number.
In the XMP tag group, the 'Lens' tag is automatically updated with the correct focal length, but in the 'Composite' tag group, the 'Lens' tag says '0.0'. Also in the Composite group, 'Lens35efl' says '0', and it is not manually writable either. I am not sure that this has any practical significance for me, I just wanted to let you know, in case this is something that should be different. This is ExifTool ver. 9.7.

Thank you for your great tool and for your help using it!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #11 on: November 18, 2014, 06:30:23 AM »
See the Composite tags documentation for a list of tags that Lens and FocalLength35efl are derived from.  It must be that one or more of these tags is set incorrectly.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #12 on: November 18, 2014, 05:48:02 PM »
Thank you! Fixed it!

hening

  • Jr. Member
  • **
  • Posts: 14
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #13 on: November 21, 2014, 04:06:24 PM »
Hi again...

Now I have performed this command on a series of images taken with a Vario Sonnar 28-70 on a Canon 5D2, shot at f=28, f/8:

exiftool -P -r -ver -FNumber=8 -ApertureValue=8 -FocalLength=28.0mm -Lens=28.0mm -minFocalLength=28 -maxFocalLength=70 "Roh orig+exifKorr"

To my surprize, in the Composite group of tags, I read

[Composite]FocalLength35efl: 28.0 mm (35 mm equivalent: 27.3 mm)
[Composite]Lens35efl: 28.0 - 70.0 mm (35 mm equivalent: 27.3 - 68.3 mm)

even though the scale factor seems right:
[Composite] ScaleFactor35efl : 1.0

What is it I have missed now??

addendum:
For a prime of f=35mm, the "35 mm equivalent" is given correctly:
[Composite]     FocalLength35efl                : 35.0 mm (35 mm equivalent: 34.2 mm)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17944
    • ExifTool Home Page
Re: Commands for writing lens aperture, f-stop and focal length?
« Reply #14 on: November 24, 2014, 06:54:04 AM »
The scale factor is rounded off to 1 decimal point.  Try using -n when extracting to avoid the rounding.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).