我有一个特殊的JPEG文件,其中包含 "用户评论 "属性中的信息。
用户评论 "属性的ID为37510。
我想做的是
a)把这个propertie作为文本
(b) 修改财产
c) 设置修改后的属性
这就读出了我想要的属性。
'Load the Imgae from the file system.
Dim image As Image = System.Drawing.Image.FromFile("Real_VRX_Image.jpg")
'The specific propertie item.
Dim propItem As PropertyItem = image.GetPropertyItem(37510)
这样做行不通,因为 "用户评论 "似乎是一个字节数组。
'Display the Text of the "User Comment" (does not work...)
MessageBox.Show(propItem.Value.ToString)
我试着使用这个函数,将字节数组转换为一个字符串,我可以编辑--但它只是制造了垃圾。
Public Function ByteArrayToString(ByRef Barr() As Byte) As String
Return Convert.ToBase64String(Barr)
End Function
谢谢
MsgBox(System.Text.Encoding.Unicode.GetString(propItem.Value))