Image.PropertyItems[] not returning all items.

PrOpHeT

Freshman
Joined
Sep 1, 2004
I am having a bit of a confusing issue with PropertyItems[] and parsing EXIF data from images...

Code:
 private void test()
        {
            int tagMake = 0x010F;  // 271
            int tagModel = 0x0110; // 272

            Image image = Image.FromFile("C:\\test3.jpg");

            byte[] make = image.PropertyItems.Single(x => x.Id == tagMake).Value;
            byte[] model = image.PropertyItems.Single(x => x.Id == tagModel).Value;

            var encoding = new System.Text.ASCIIEncoding();

            Trace.WriteLine(encoding.GetString(make)); 
            Trace.WriteLine(encoding.GetString(model)); 
        }

The above returns these two tags from *some* images, some it errors and says that they are not there. for instance I can download sample images with EXIF data from the internet, and parse this information without any apparent issue.

The images that are in error come from two android devices, one is an HTC One, the other a Note 3.

However on all those images it does not report those fields on, all other EXIF editors I can find *do* show them there, and with the correct ID.

Likewise just cycling through shows many other tags, but never those two (perhaps missing more, I have not compared them all)

Code:
    Image Img;
            Img = new Bitmap("C:\\test3.jpg");
            foreach (PropertyItem item in Img.PropertyItems)
            {
                Trace.WriteLine(item.Id);
            }

Shows just about everything *but* those tags...:confused:

So the main question is why other editors locate them without issue, but .NET consistently fails to see them?
 
Top Bottom