Question How do I convert an image to binary?

matt1234hi5

Member
Joined
May 13, 2008
Messages
12
Programming Experience
1-3
Hello everyone. I am making a twitter client and I am trying to make it able to upload pictures.

I've found this website called twitpic that has an api that I can use to upload it. [More info: http://twitpic.com/api.do#upload]

But it requires the image to be in binary, and I have no idea how to convert an image so that the api will like it.

Any help?
 
here is an example but i wonder issit suit your case.

VB.NET:
Public Function convertImageToBinaryArray(ByVal imagePath As String) As Byte()
        Dim fs As IO.FileStream = New IO.FileStream(imagePath, FileMode.Open, FileAccess.Read)
        Dim br As IO.BinaryReader = New IO.BinaryReader(fs)
        Dim imageByte() As Byte = br.ReadBytes(fs.Length)
        br.Close()
        fs.Close()
        Return imageByte
End Function
 
Back
Top