Conversion issue: Image>Byte array>Image

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
 
G

Guest

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

Members online

No members online now.

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top