在C#.Net 2.0中写入图像元数据

时间:2013-01-17 09:25:49

标签: c# .net image metadata

是否有人知道是否可以将元数据写入C#中的BitMap类?限制条件是只能使用 NET 2.0

我在C#中读到了PropertyItem类,但没有解释如何设置属性;它只展示了如何获得财产。

谢谢!

1 个答案:

答案 0 :(得分:1)

是的,这是可能的。这是VB中的一个例子。

  Dim prop As PropertyItem
  prop = img.PropertyItems(0) ' no constructor   
  prop.Id = tagNo
  prop.Len = nBytes
  prop.Type = dataType
  prop.Value = bs   
  img.SetPropertyItem(prop)

imgImagebsbyte的数组。)您必须将图像保存到新文件中,因为.net显然是读取来自旧文件的exif数据,而不是将其保存在内存中。