We have a couple folks, right now, going through a directory of thousands of jpgs and hand-setting the Tags metadata item on them in Windows explorer. I want to whip something up to just read the spreadsheet they're getting the tags from and applying them to the files.
In the research I've done, it seems that the "Tags" metadata in Windows is actually the "Keywords" xmp metadata. I've successfully managed to read this metadata using the following code:
FileStream fs = new FileStream(@"C:\test.jpg", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
BitmapSource img = BitmapFrame.Create(fs);
BitmapMetadata md = (BitmapMetadata)img.Metadata;
StringBuilder tags = new StringBuilder();
foreach (String s in md.Keywords)
{
tags.Append(s);
tags.Append(";");
}
String fin = tags.ToString();
The problem is that the Keywords property is a read-only collection. I've found several "leads" on writing to this metadata, but none of them seem to work. It especially sucks because if I open the file in notepad++, I can see exactly where the metadata is stored, but the number of xml tags around them is messy enough that trying to just manually jam things in there won't work. Does anyone have any information on how to write to the Keywords jpg metadata in Windows using C#?
Just to show I really tried, here's a bunch of links I've tried using: