【发布时间】:2012-07-08 21:51:03
【问题描述】:
我正在尝试在退出调整大小时设置图像的元数据,该属性似乎已设置,但保存后什么都没有。
我很确定我在做一些愚蠢的想法。
var pi = createPropertyItem();
pi.Id = 40091;
pi.Len = "SomeText".Length;
pi.Type = 2;
pi.Value = Encoding.UTF8.GetBytes("SomeText");
SrcImage.SetPropertyItem(pi);
SrcImage.Save(@"C:\temp\withTag.jpg");
private PropertyItem createPropertyItem()
{
var ci = typeof (PropertyItem);
var o = ci.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public , null, new Type[] {} , null);
return (PropertyItem)o.Invoke(null);
}
【问题讨论】: