0

I have to modify the iptc metadata of 6000+ jpg images. Unfortunately, I didn't found any library or even an example for doing so.

Could you please give me a hint how to modify the metadata of images or point me to a site where I can inform myself?

Christopher
  • 2,005
  • 3
  • 24
  • 50
  • possible duplicate of [IPTC .NET read/write c# library](http://stackoverflow.com/questions/5597079/iptc-net-read-write-c-sharp-library) – p.s.w.g Apr 05 '13 at 21:49
  • I already read this question & answer, but as I understand it, the code only describes how to read metadata, not how to write it – Christopher Apr 05 '13 at 21:56

1 Answers1

1

A quick glance at the System.Windows.Media.Imaging namespace revealed the InPlaceBitmapMetadaWriter class. I think this is what you're looking for:

Stream pngStream = new System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
PngBitmapDecoder pngDecoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapFrame pngFrame = pngDecoder.Frames[0];
InPlaceBitmapMetadataWriter pngInplace = pngFrame.CreateInPlaceBitmapMetadataWriter();
if (pngInplace.TrySave() == true)
{
    pngInplace.SetQuery("/Text/Description", "Have a nice day."); 
}

pngStream.Close();
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331