wpf - Trying to write to the Keywords windows metadata item using C# -
we have couple folks, right now, going through directory of thousands of jpgs , hand-setting tags metadata item on them in windows explorer. want whip read spreadsheet they're getting tags , applying them files.
in research i've done, seems "tags" metadata in windows "keywords" xmp metadata. i've managed read metadata using 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 keywords property read-only collection. i've found several "leads" on writing metadata, none of them seem work. sucks because if open file in notepad++, can see metadata stored, number of xml tags around them messy enough trying manually jam things in there won't work. have information on how write to keywords jpg metadata in windows using c#?
just show tried, here's bunch of links i've tried using:
after lot more googling (with keywords don't make lot of sense), found other question tells how windows api code pack: is possible set/edit file extended properties windows api code pack?
to codepack, open pack manager console in vs , enter install-package windowsapicodepack
ms have pulled package msdn's archive, nuget way it. figures they'd make 50x harder needed be, since msdn article property system brags how it's future of managing files in windows.
Comments
Post a Comment