Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does reading lensid work? #264

Open
Offerel opened this issue May 18, 2024 · 4 comments
Open

How does reading lensid work? #264

Offerel opened this issue May 18, 2024 · 4 comments

Comments

@Offerel
Copy link

Offerel commented May 18, 2024

This is not exactly a exiftool question, basically I try to solve this issue in PHP with $exifarray = exif_read_data($imagefile).

When I use exiftool -lensid /path/to/imagefile, I get exactly the info what I need. But with exif_read_data() I couldn't find neither a string or id or anything else which is close to a reliable id or string to identify the lens.

Can someone please tell me, how exiftool can identify the correct lens? Which exif fields can I use?

@StarGeekSpaceNerd
Copy link
Collaborator

LensID isn't an actual tag in the file. It is a Composite tag that is created on the fly by looking at multiple different tags and checking the results against a lookup table of known lenses. And even this isn't 100% perfect because the same data might apply to multiple different lenses.

If you look at the entry for LensID on the link above, you'll see that it is split into five different groups, with each one looking at different sets of data to figure what lens was used.

All of this data wasn't copy/pasted from some source. It was built up over the past decade+ from information gathered from users and other programs, such as LibRaw. See the Post your LensType / LensID discoveries here thread on the Exiftool forums.

@Offerel
Copy link
Author

Offerel commented May 18, 2024

Ok. So this means, I have no chances to find or compute such things with PHP, without deeper knowledge...

@StarGeekSpaceNerd
Copy link
Collaborator

StarGeekSpaceNerd commented May 18, 2024

Unfortunately, that is correct. And since some of the data will appear in the MakerNotes, I doubt you'll be able to use exif_read_data to access that data. The MakerNotes format differ between companies, and often between different models from the same company. I doubt that the exif_read_data is updated as often as necessary to keep track of all these changes.

@kmilos
Copy link

kmilos commented May 21, 2024

You could support just the "standard" Exif 0xa434 LensModel (and 0xa433 LensMake) tags. Thankfully some camera manufacturers started using those more recently instead of (or in addition to) their proprietary MakerNotes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants