Author Topic: Is there a way to get the lens serial number?  (Read 551 times)

Fortuna Wolf

  • New to the forum
  • *
  • Posts: 11
Is there a way to get the lens serial number?
« on: February 19, 2019, 05:28:42 AM »
Sketching out a script I plan on writing. Is there a way to get the serial number for a lens? I see there's a way to get the lens name, but I assume this means "50mm 1.8 STM" only.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12290
  • Emergencies only
Re: Is there a way to get the lens serial number?
« Reply #1 on: February 19, 2019, 07:31:27 AM »
Like this ?
menu.get("Lens info", "Serial num")
Yes, making this info available to Lua is not a bad idea. Meanwhile, you can extract info from anywhere in the ML menu.

aprofiti

  • Contributor
  • Member
  • *****
  • Posts: 185
Re: Is there a way to get the lens serial number?
« Reply #2 on: February 19, 2019, 12:08:30 PM »
You can use "lens.serial" in a lua script if using "Non-CPU lens info" from the experimental builds.

Notice that the serial number returned is an integer and may be different from the one showed in the Lens Info menu (exiftool version).

Edit: Tried it and return "0" because ML lens_info.serial field is not updated automatically with my lens (also show "(none)" in Lens Info menu).
I imagine that with a Canon's lens it should be retrieved correctly from ML.

Fortuna Wolf

  • New to the forum
  • *
  • Posts: 11
Re: Is there a way to get the lens serial number?
« Reply #3 on: February 21, 2019, 05:45:59 AM »
Thanks! I'll try these out.