3

This is my image. The image had tags = Jejemon; heller;

I want to get this tag using c# in application form.

enter image description here

This is my code:

 OpenFileDialog data = new OpenFileDialog();
 Image img = Image.FromFile(data.FileName);

when I look the img.tag shows null, but in my image had Jejemon; heller; tags. How can I get the img.Tag?


This is the best answered I found. http://social.msdn.microsoft.com/Forums/vstudio/en-US/08d4f986-b416-4a94-ae0c-13361c9929d1/extract-file-properties

vegas red
  • 259
  • 4
  • 12
  • You need to access the extended file properties - see my answer for a link to another SO question that might provide a solution. – Thorsten Dittmar Jun 28 '13 at 07:43
  • The accept answer doesn't really solve the problem. I find the answer here: [link](https://stackoverflow.com/questions/26646068/getting-metadata-information-from-a-file-using-c-sharp). And for a list of columns from GetDetailsOf, here is a useful overflow site: [link](https://stackoverflow.com/questions/22382010/what-options-are-available-for-shell32-folder-getdetailsof/37061433#37061433) – Weihui Guo Apr 13 '17 at 16:23

2 Answers2

4

I think you might be talking about the EXIF metadata inside the image, if set. Take a look at this example: http://www.holmessoft.co.uk/homepage/Software/ExifUsage.htm

UPDATE: Could you perhaps provide a link to the original image file, so we can take a look at it in detail?

Rob
  • 11,492
  • 14
  • 59
  • 94
3

What would you expect img.Tag to be? The Tag property is a property that can take any value you want, but it is not initialized by default to anything.


The Tag field does not contain the EXIF information or other image meta data - this is a misunderstanding on your end :-)


The information you're showing in your screen shot is not imported when you load an image. The Tag property in your code is in no way related to the file properties. You need to access the file properties. This question seems to provide an answer. One of the answers contains this:

The solution to this is the property indexer FolderItem.ExtendedProperty and if you drop all spaces in the property's name, you'll get the value. E.g. File Version goes FileVersion, and there you have it.

Community
  • 1
  • 1
Thorsten Dittmar
  • 55,956
  • 8
  • 91
  • 139