0

I have specific kind of JPEG files, which contain information in the "User Comment" propertie.

The "User Comment" propertie has the ID of 37510.

All I want to do is:

a) Get the propertie as text

b) Modify the propertie

c) Set the modified propertie

This reads the propertie I want.

'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)

This do not work, because the "User Comment" seems to be an byte array.

'Display the Text of the "User Comment" (does not work...)
MessageBox.Show(propItem.Value.ToString)

I have tried to use this function, to convert the byte array to a string, which I can edit - but it just created garbage.

Public Function ByteArrayToString(ByRef Barr() As Byte) As String
Return Convert.ToBase64String(Barr)
End Function

Thx

Andreas
  • 545
  • 2
  • 11
  • 24
  • 1
    See the answer to [this question](http://stackoverflow.com/questions/24960787/how-do-i-edit-jpg-file-title-subject-comments-and-tags-keywords-follow-up?rq=1) – Grim Aug 11 '14 at 13:51
  • And [this one](http://stackoverflow.com/questions/58649/how-to-get-the-exif-data-from-a-file-using-c-sharp) (with several other links in it...) – Grim Aug 11 '14 at 13:53

1 Answers1

-1

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

none
  • 1