Hello,
I am very interested in extracting the lens model name for each photo. Does exiftool always display the lens name under the same tag or is it different for different manufacturers? Upon testing so far with Canon and Nikon cameras I have noticed that "Lens" and "LensID" seem to be present in both photos with the same format. Is this true for other brands as well?
Thanks!
LensID is a composite tag designed to be consistent across all makes.
- Phil
Great! Thanks!
Hi again,
I ran exiftool through a db of photos and for some canon lenses I just got id's instead of text.
The "Lens" tag would for example contain data like:
EF28mm f/1.8 USM
EF50mm f/1.4 USM
EF70-200mm f/4L USM
EF24-105mm f/4L IS USM
EF-S60mm f/2.8 Macro USM
EF100-400mm f/4.5-5.6L IS USM
EF-S18-135mm f/3.5-5.6 IS
EF-S18-55mm f/3.5-5.6 IS
While the LensID would have numbers such as 144.
Are these lenses supported or are these special cases?
Thanks
If you want the numbers for Canon lenses, use -lenstype# on the command line. If you want the model names, use -lensid.
Please tell me the lens name and the corresponding unknown LensID number if ExifTool doesn't properly report the model name for a lens and I will add it to the list.
- Phil
Hi,
I tried with the -lensid but nothing changed. I have written a script to go through about 20,000 photos. I get a lot of photos with empty LensID values but I assume this is because of re-saved photos. I however as described above get a lot of photos with LensID numbers. See the list below. The first value is the LensID and the second is the Lens.
10 105mm
102 18.0-35.0 mm f/3.5-4.5
105 70.0-300.0 mm f/4.0-5.6
118 50.0 mm f/1.8
120 24.0-120.0 mm f/3.5-5.6
127 18.0-70.0 mm f/3.5-4.5
138 105.0 mm f/2.8
140 18.0-55.0 mm f/3.5-5.6
144 55.0-200.0 mm f/4.0-5.6
148 18.0-55.0 mm f/3.5-5.6
154 18.0-55.0 mm f/3.5-5.6
158 18.0-105.0 mm f/3.5-5.6
159 35.0 mm f/1.8
161 17-35mm
161 17-50mm
165 EF70-200mm f/2.8L USM
168 EF28mm f/1.8 USM
178 EF28-135mm f/3.5-5.6 IS USM
180 EF35mm f/1.4L USM
183 EF100-400mm f/4.5-5.6L IS USM
186 EF70-200mm f/4L USM
190 EF100mm f/2.8 Macro USM
198 EF50mm f/1.4 USM
205 18.0-125.0 mm f/3.8-5.6
206 150.0-500.0 mm f/5.0-6.3
229 105.0 mm f/2.8
230 EF24-70mm f/2.8L USM
231 EF17-40mm f/4L USM
235 EF-S10-22mm f/3.5-4.5 USM
236 EF-S60mm f/2.8 Macro USM
237 EF24-105mm f/4L IS USM
246 EF16-35mm f/2.8L II USM
249 10.0-20.0 mm f/4.0-5.6
251 EF70-200mm f/2.8L IS II USM
25501 50mm F1.7
27 NULL
27 50-50mm
28 100mm F2.8 Macro
28 70-300mm
29 EF50mm f/1.8
29 EF50mm f/1.8 II
3 44 Sigma or Tamron Lens
39 EF75-300mm f/4-5.6
4 249 TAMRON XR DiII 18-200mm F3.5-6.3
40 EF28-80mm f/3.5-5.6
45 EF-S18-55mm f/3.5-5.6
48 EF-S18-55mm f/3.5-5.6 IS
49 EF-S55-250mm f/4-5.6 IS
50 105.0 mm f/2.8
50 DT 18-250mm F3.5-6.3
50 EF-S18-200mm f/3.5-5.6 IS
51 28.0-75.0 mm f/2.8
51 EF-S18-135mm f/3.5-5.6 IS
54 24.0 mm f/2.8
56 85.0 mm f/1.8
6 NULL
65535 NULL
65535 17.0-35.0 mm
65535 5.0-100.0 mm
65535 6.0-22.5 mm
65535 70.0-200.0 mm
65535 EF24-105mm f/4L IS USM
67 50.0 mm f/1.4
78 135.0 mm f/2.0
I really don't understand what you are doing. ExifTool will identify almost all of the lenses you mention.
If you could provide the exact command line you are using and a sample output maybe I can understand the problem.
Also, what version of exiftool are you using?
- Phil
No worries. I am running the latest 8.56.
I have script that runs the command exiftool -j pathtoimage.
I run the command on 20000 images and get about 150 unique lenses in return. Most of the lenses get a model name from LensID such as "AF-S DX VR Zoom-Nikkor 18-105mm f/3.5-5.6G ED" and "Canon EF 50mm f/1.8 II", but for some images I just get a number in return as shown above. For example one image gives the LensID "29" and the corresponding Lens value "EF50mm f/1.8". Why is a number returned instead for these images? Is this lens different from the others?
If you want I can e-mail some sample images that output these numbers.
Thanks!
Thanks for the details.
Quote from: surfer on May 26, 2011, 01:42:01 PM
but for some images I just get a number in return as shown above.
This is very odd, because you should get an output like "Unknown (130)", and not just a number. But you should only get this for unknown lenses.
QuoteIf you want I can e-mail some sample images that output these numbers.
Yes, please! Send them to philharvey66 at gmail.com
- Phil
Great. I have sent you an e-mail now :)
Thanks for the samples.
Ah, right. I forgot about XMP:LensID. Adobe introduced this tag after I had already established the Composite:LensID tag generated by ExifTool. Use the -G1 option to see which one you are getting.
Honestly, I don't see how I can make things consistent with these Adobe XMP tags. I don't have enough information to properly convert the LensID numbers stored by Adobe. Too bad they do it this way instead of just preserving the maker notes. Dumb, really.
- Phil
I understand. I seem to get "XMP-aux:LensID" for these photos.
So the only solution for the time being is that I filter out the values that don't have the "Composite:LensID" tag? I guess I will need to run the command twice to get one with the -G1 option and one without as the key's will change then for each photo when I get the other values?
It's a shame that the information from these lenses get lost but as you said it's dumb that Adobe can't make things consistent. Is it mainly adobe that does this or do other popular apps do this as well?
Thanks!
There should be no need to run the command twice. Just ignore the XMP:LensID with --xmp:lensid.
- Phil
Thanks I will try that!
Is there a chance by using that option that I might miss any lenses that would be supported by exiftool?
ExifTool doesn't convert the numerical XMP:LensID values, so if the lens is recognized by ExifTool the information will be contain in another tag.
- Phil
I re-ran my test script with the option you proposed and actually found a few photos with exiftools "Composite:LensID" containing pure numbers.
"Composite:LensID": 6,
Do you want me to send a sample?
Yes, please.
- Phil
Sent!
Thanks. The problem here is that the maker notes have been corrupted by some other image-editing software, and the LensModel tag contains invalid data (coincidentally, an ASCII "6", making the LensID numeric):
Warning: [minor] Adjusted MakerNotes base by -56
Warning: Invalid CanonCameraSettings data
Warning: Invalid CanonShotInfo data
Warning: Invalid CanonAFInfo2 data
Warning: Invalid CanonFileInfo data
Warning: Invalid CustomFunctions2 data
Warning: Invalid ProcessingInfo data
Warning: Invalid MeasuredColor data
Warning: Invalid SensorInfo data
Just FYI, the correct adjustment to properly read these maker notes is -76, and with -F-76 you will see the correct LensID.
- Phil
I understand. I will try that.
Thanks for your help!
Quote from: Phil Harvey on May 26, 2011, 03:05:38 PM
Honestly, I don't see how I can make things consistent with these Adobe XMP tags. I don't have enough information to properly convert the LensID numbers stored by Adobe. Too bad they do it this way instead of just preserving the maker notes. Dumb, really.
This was bugging me, so I added a new Composite:LensID tag which attempts to convert the Adobe XMP-aux:LensID number(s) as best I can. This update will appear in ExifTool 8.59, which will likely be released this weekend.
- Phil
Great news Phil :)
Will I be able to access this data as usual through the LensID tag or is it a separate tag? Does this mean that photos e.g. saved in lightroom might now get the correct Lens ID?
Keep up the good work!
The new Composite:LensID tag will override the XMP-aux:LensID tag unless you allow duplicate tags to be extracted (with the -a option) or specify an XMP group explicitly. The hope is that the Composite LensID's generated from LR and Photoshop images will be correct.
- Phil
Edit: Note that this won't work for Olympus, Ricoh or Minolta cameras since Adobe doesn't store a LensID in these images (I have no idea why). But Canon, Nikon, Pentax, Leica, Sigma, Samsung and Sony should be OK.
Exiftool v8.61 doesn't seem to know the correct English name for this lens: "Nikon 200-400mm f/4 AF-S VR II".
The LensID tag, which usually gives me a nice displayable string, gives me this: "Lens ID : Unknown (A8 48 80 98 30 30 AA 0E)"
Quote from: Batty on July 17, 2011, 07:24:21 PM
Exiftool v8.61 doesn't seem to know the correct English name for this lens: "Nikon 200-400mm f/4 AF-S VR II".
The LensID tag, which usually gives me a nice displayable string, gives me this: "Lens ID : Unknown (A8 48 80 98 30 30 AA 0E)"
Excellent, thanks! This will be added to the next release (version 8.62)
- Phil
Thanks, appreciate it!
Yay, I can verify the Nikon 200-400 II now shows a correct "AF-S VR Zoom-Nikkor 200-400mm f/4G IF-ED II" for the LensID tag in 8.62.
Finally I got EXIFTOOL working ... Nice, very nice tool.
But, I see that in all my jpg's do not shown the right lensname, while the NEF's do.
As I understood, Adobe changes this in a mess ...
It there a way to retrieve them in the correct manner ? Or is it better making a referncetable ? I almost uses the same type of lenses
thanks
Are the original files available? If so, you could copy the lens name from the original to the Adobe-edited JPG.
- Phil
Phil
Tamron SP AF 180mm f/3.5 Di LD IF Macro
I have a nef and a jpg.
http://www.fotospotter.be/download/VMW_6682.nef
http://www.fotospotter.be/download/VMW_6682.jpg
Unfortunately I'm on a slow network connection from home, so it will be Monday before I can take a look at these files, but I was thinking about maybe something like this:
exiftool -tagsfromfile %d%f.nef "-lensmodel<lensid" -ext jpg DIR
Where DIR is the name of a directory containing the JPG and NEF images. Alternatively, the full maker notes (including the original lens data) could be recovered with:
exiftool -tagsfromfile %d%f.nef -makernotes -ext jpg DIR
- Phil
Thanks, I could copy all Makernotes from NEF and inserted them into the JPG's.
At last these now are conform each other.
One question, perhaps a mazy person here, but may the jpgs be placed somewhere else (other DIR on another drive) ?
anyway, this is working nice.
The JPG files may be in any directory. Just specify the DIR for the JPG image in the command, and specify the directory for the NEF images in the -tagsFromFile argument:
exiftool -tagsfromfile d:\directory\for\nef\files\%f.nef -makernotes -ext jpg DIR
- Phil