Conversion issue: Image>Byte array>Image

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Heres the code I have:

Dim objTheStream As MemoryStream = New MemoryStream
Dim objPhoto As Image = pic_PhotoToUpload.Image()
With objPhoto
.Save(objTheStream, System.Drawing.Imaging.ImageFormat.Jpeg)
End With
Dim objByteToSend(objTheStream.Length) As Byte
objByteToSend = objTheStream.ToArray()

Dim objPhoto2 As Image
Dim objTheStream2 As MemoryStream = New
MemoryStream(objByteToSend, 0, objByteToSend.Length)
objTheStream2.Write(objByteToSend, 0,
objByteToSend.Length)
objPhoto2.FromStream(objTheStream, True)

Why does objPhoto2 = nothing after that last line ?

Thanks
Deasun
 
thanks for the reply.
Just had to make objPhoto2 = objPhoto2.FromStream(objTheStream, True)
And it works. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top