PrOpHeT Posted February 28, 2014 Posted February 28, 2014 I am having a bit of a confusing issue with PropertyItems[] and parsing EXIF data from images... 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) 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? Quote Life is a comedy to those who think; a tragedy to those who feel.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.