how can I set the metadata of an image using WPF?
WPF has an Image开发者_StackOverflow社区Source which has a BitmapMetadata.
However, the Metadata property is read only an the BitmapMetadata is frozen.
So I can I modify the metadata of an image?
Unfortunately the WPF imaging API doesn't allow you to modify the image metadata... However, you can still do it with GDI+ (System.Drawing)
Found the answer:
var frame = ...;
BitmapMetadata newMetadata = ...;
var newFrame = BitmapFrame.Create(frame, frame.Thumbnail, newMetadata, frame.ColorContexts);
var encoder = new JpegBitmapEncoder();
encoder.Frames.Add(newFrame);
精彩评论