gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 13:48:43 32 4
gpt4 key购买 nike

有人知道是否可以在 C# 中将元数据写入 BitMap 类吗?约束是只能使用 .NET 2.0

我阅读了 C# 中的 PropertyItem 类,但它没有解释如何设置属性;它只显示了如何获取该属性。

谢谢!

最佳答案

是的,这是可能的。这是 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)

(img 是一个Imagebs 是一个byte 数组。)你必须保存将图像放入新文件中,因为 .net 显然是从旧文件中读取 exif 数据,而不是将其保存在内存中。

关于c# - 在 C# .Net 2.0 中写入图像元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14375802/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com