使用vb.net从一个JPEG文件中读取和修改 "用户评论"。

问题描述 投票:0回答:1

我有一个特殊的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

谢谢

vb.net image exif
1个回答
-1
投票

MsgBox(System.Text.Encoding.Unicode.GetString(propItem.Value))

© www.soinside.com 2019 - 2024. All rights reserved.