【发布时间】:2021-04-06 14:51:26
【问题描述】:
我需要使用 wpf c# 中的版权等 medata 将位图保存为 jpg。
var handle = BitmapImage2Bitmap(currentimage).GetHbitmap();
System.Drawing.Image img = System.Drawing.Image.FromHbitmap(handle);
System.Drawing.Imaging.PropertyItem prop = img.PropertyItems[0];
SetProperty(ref prop, 33432, "Copyright");
img.SetPropertyItem(prop);
img.Save(@"C:\images\test.jpg");
我已经尝试使用上面的代码,但它说索引超出了数组区域。
【问题讨论】:
-
以后请先阅读文档
-
System.Drawing.Image是 WinForms,而不是 WPF。