7
\$\begingroup\$

Is there a way to find out using which lens an image was taken, especially in Ubuntu?

I tried using exif utility which gives me following o/p:

$ exif 20111030.JPG

--------------------+----------------------------------------------------------
Tag                 |Value
--------------------+----------------------------------------------------------
Exposure Time       |1/80 sec.
F-Number            |f/2.8
Exposure Program    |Manual
ISO Speed Ratings   |1250
Shutter Speed       |6.32 EV (1/79 sec.)
Aperture            |2.97 EV (f/2.8)
Metering Mode       |Pattern
Focal Length        |70.0 mm
--------------------+----------------------------------------------------------

However, this only tells me the details of the settings which can be achieved using two different lenses. I want to find out the exact brand and model of the lens? Does EXIF store this info?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Most cameras include lens info in the EXIF data. Sometimes other utilities such as 'EXIF Utility' doesn't read all the fields properly. What camera did the image come from? \$\endgroup\$
    – Michael C
    Nov 18, 2013 at 6:36
  • \$\begingroup\$ For exif viewer, Google with search string "exif viewer", there's plenty. I use online viewer - Jeffrey's exif viewer when convenient. \$\endgroup\$ Nov 18, 2013 at 16:08
  • \$\begingroup\$ Short answer; only if the camera wrote it into the EXIF data (which can vary for each manufacturer, model, version and firmware release) \$\endgroup\$
    – db9dreamer
    Nov 18, 2013 at 20:45

7 Answers 7

6
\$\begingroup\$

How to see it?

You may find Lens model description in the image metadata with an Exif viewer that is able to translate the MakerNotes section of the metadata. I use either my RAW-converter software or an online viewer - Jeffrey's exif viewer at Regex.info. Google can find several Exif viewers for you, but not all of them read and/or translate MakerNotes.

Is it there?

Chances to find correct lens info from metadata are good when the camera and lens are both from the same manufacturer. However, third party lenses may show up with invalid or missing lens model info. Also the use of a teleconverter, extension tube or adapter ring may lead to incorrect or missing Lens model info. What more, many photo gallery sites, and for example Facebook, intentionally strip most or all Exif info (and the rest of metadata) off the images.

How is it done?

Lens is recognized by the camera only if its ID-code is known to it. Camera makers include information of several lenses in the firmware, but if a certain lens you use is not included, then the camera can not recognize it correctly.

Some basic specs of a lens is transferred from lens to camera (for example focal length and the maximum usable aperture at current zoom level) and those are then included in EXIF data. Lens model info is not included in the basic EXIF-data but is found in MakerNotes section instead.

Each lens has its own ID-code which is sent to the camera body when an image is captured. Camera body firmware has a lookup table for these ID-codes. A code that is found in the lookup table is translated into uniform (per camera manufacturer) code and gets written into MakerNotes section of metadata of the image. It is up to the EXIF reader software to interpret the lens model code into a lens model description. Base line is, correct info can only be found if the info is already known by the camera.

Two examples:

For example my Sony A37 does not quite recognize my telezoom lens:

Lens Model     75-300mm F4.5-5.6
Max aperture   F4.0

Almost correct but not quite there. See how the lens is first recognized as f/4.5-5.6 but then maximum aperture is a hard fact transferred from lens to camera as f/4.0 (which is true). The lens is actually a Sigma 70-300 f/4-5.6 DG so even the focal range was wrong in EXIF. What happened here is that the ID-code sent by the lens falls into slot 25611 of the lookup table. That number is reserved for "Minolta AF 75-300mm F4.5-5.6 or Sigma Lens". An EXIF reader that I use then shows this as simply "75-300mm F4.5-5.6" in Lens Model field.

A lens that is recognized by my camera has exact info:

Lens Model     DT 18-55mm F3.5-5.6 SAM
Max aperture   F4.0

The lens is Sony's own model, a Sony DT 18-55 f/3.5-5.6 SAM and so quite naturally included in the camera's firmware. The max aperture is f/4.0 because in this case the lens was zoomed in a bit, which has an effect on the max possible aperture.

Updating your camera's firmware may increase the number of lenses your camera can recognize, but it is up to the EXIF reader software to show the lens description instead of just a code in MakerNotes.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Great point. This surprised me this week as I had a bunch of photos taken with the same lens appear with the correct lens and unknown lens in Lightroom! After scratching my head, I realized it was not recognized on one camera but recognized on two others! So, yes, it does seem to depend on the camera. I'll check for a new firmware. \$\endgroup\$
    – Itai
    Nov 18, 2013 at 14:35
3
\$\begingroup\$

One possibility is to use exiftool. You will need to have perl installed, but since it is included in Debian and Ubuntu by default, this should not be a problem.


The installation process is quite straightforward:

  • Use a package manager to get exiftool (this will also check if all dependencies are fulfilled): e.g. apt-get install exiftool Thanks @mattdm!

If you want the very latest version of exiftool:

  • Download the latest (production) release (the *.tar.gz-file) via your browser / wget
  • Open up your Terminal:
    • cd <PATH_TO_exiftool.tar.gz>
    • gzip -dc Image-ExifTool-<VERSION>.tar.gz | tar -xf -
    • cd Image-ExifTool-<VERSION>
    • perl Makefile.PL
    • make test (not necessary - just tests if everything works)
    • sudo make install (not necessary - will install exiftool so you can call it from everywhere)

After the installation, you can run exiftool:

    exiftool -Lens -LensID -Aperture -FocalLength -FocusDistance -DOF TESTIMAGE.CR2

exiftool -Lens -LensID -Aperture -FocalLength -FocusDistance -DOF TESTIMAGE.CR2

Please note that not all tags are available in all formats. Some also change with manufacturers. You can find out about all tags at the exiftool tag names site and/or at the composite tags site (as the site explains: "The values of the composite tags are derived from the values of other tags.")


Other things exiftool can do:


Note: I am not in any way affiliated with exiftool - I just like it very, very much.

\$\endgroup\$
4
  • \$\begingroup\$ Is this not in the repos for Debian and Ubuntu? On Fedora, Perl is not installed by default, but yum install exiftool will automatically pull in everything you need. \$\endgroup\$
    – mattdm
    Nov 12, 2018 at 13:26
  • \$\begingroup\$ @mattdm You mean that e.g. apt-get install exiftool would automatically install perl? I would have to test that, though I consider it a small point: If it's already installed, you are good, and if it isn't, then you can install it in just a few seconds. ((I had too few cups of coffee today...did this answer your question?)) \$\endgroup\$
    – flolilo
    Nov 12, 2018 at 13:33
  • \$\begingroup\$ Well, yes, that, but why build from source instead of just using the distro package in the first place? \$\endgroup\$
    – mattdm
    Nov 12, 2018 at 13:43
  • \$\begingroup\$ @mattdm ...because exiftool's page tells us to? :-D Most likely versions from the website will be more recent, which can make a difference when you own a very new lens. But you are of course right: Using a package management tool to get it will work, too. I will include it in my answer. Thanks! \$\endgroup\$
    – flolilo
    Nov 15, 2018 at 9:36
2
\$\begingroup\$

I suggest you try:

exiv2 -pa image.jpg | grep Lens

An example from one of my recent images includes:

Exif.NikonLd3.LensIDNumber Byte 1 Nikon AF-S Zoom-Nikkor 24-70mm f/2.8G ED
\$\endgroup\$
0
1
\$\begingroup\$

EXIF should have the model name and brand of lens, but the image you got might be edited and this info are not incluede

\$\endgroup\$
3
  • 1
    \$\begingroup\$ While this is true in most cases, it is not always true, particularly for third party lenses. If the lens doesn't know how to communicate it's identity to the camera and the camera doesn't have the necessary information to recognize the lens, then the information will not be available. This can be a problem quite regularly with either newer or older third party lenses than the camera being used. \$\endgroup\$
    – AJ Henderson
    Nov 19, 2013 at 21:33
  • \$\begingroup\$ in your case, no software tools could help at all \$\endgroup\$
    – gcd0318
    Nov 20, 2013 at 16:00
  • 1
    \$\begingroup\$ agreed, but that's the point. In some cases it isn't possible. \$\endgroup\$
    – AJ Henderson
    Nov 20, 2013 at 16:02
0
\$\begingroup\$

I was just looking for same info regarding lens type/model. Eventually I turned to Picasa and it gives nearly all the EXIF info you require. I can pick my lens (if the brand is not shown) by the focal length eg Sigma 18-250 just comes up as lens = 18-250. I hope this info was helpful - certainly was for me.

\$\endgroup\$
0
\$\begingroup\$

I use RAWTherapee to load and find not only the lens focal range 70 to 300mm but the focal length for the particular photo 230mm (I am not a professional photographer, not fully sure)

enter image description here

\$\endgroup\$
-1
\$\begingroup\$

I'm on Mac... I'm on Nikon... There is this software from Nikon:

ViewNX-i Ver 1.2.12

You select the path from the computer to the folder with the photos and the right panel shows the File and Camera Information panel.

Nikon VR 55-200mm f/4-5G lens:

Nikon 55-200mm f/4-5G

Nikon VR 18-55mm f/3.5-5.6G lens:

Nikon 18-55mm f/3.5-5.6G

Prime Nikon 35mm f/1.8G lens:

Prime Nikon 35mm f/1.8G

Note: these are NEF raw files...

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.