Is there a way to get the lens serial number?

Started by Fortuna Wolf, February 19, 2019, 05:28:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fortuna Wolf

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

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

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