Docs: Error in the code example

Created on 30 Jan 2019  Â·  3Comments  Â·  Source: dotnet/docs

First of all, thank you so much for providing the code example. As a newbie in C# I had a hard time trying to get the manufacturer information from image EXIF meta, and the code snippet provided here is a great starting point. However, this piece of code (checking manufacturer) seems to be working for images taken by iOS only. When I tested it on an image taken by OnePlus, it's not returning the string as expected. That's because the code currently has string manufacturer = encoding.GetString(propItems[1].Value);. Manufacturer information does not always shows as the first item in the PropertyItems list. It's associated with Id 271 though. So I think the code should be updated as string manufacturer = encoding.GetString(image.GetPropertyItem(271).Value);. I was able to see the manufacturer string of OnePlus images correctly then.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Area - .NET Framework Guide Technology - WinForms P2 Pri2 doc-bug dotnet-frameworprod sample-code

All 3 comments

Thanks for your feedback @mekomlusa. Let me test your suggestion and we can get that implemented if it works.

To add some supporting documentation for mekomlusa's correction request:

According to the EXIF spec ( https://www.exif.org/Exif2-2.PDF ), "Note that field Interoperability shall be recorded in sequence starting from the smallest tag number. There is no stipulation regarding the order or position of tag value (Value) recording. "

Also according to the spec, 271 (10F.H) is the correct tag for returning the "Make" (i.e., manufacturer) field.

So, assuming the suggestion works (I did not test it), it should be reliable.

I'm having to move this to the backlog because of other priorities at the moment. Apologies on that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FrancescoBonizzi picture FrancescoBonizzi  Â·  3Comments

svick picture svick  Â·  3Comments

sime3000 picture sime3000  Â·  3Comments

Manoj-Prabhakaran picture Manoj-Prabhakaran  Â·  3Comments

ygoe picture ygoe  Â·  3Comments