Sub bytestobitmap(bytes() As Byte) As Bitmap
Dim bmp As Bitmap
Dim instr As InputStream
instr.InitializeFromBytesArray(bytes,0,bytes.Length)
bmp.Initialize2(instr)
Return bmp
End Sub
Sub BytesToFile (Dir As String, FileName As String, Data() As Byte)
Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
End Sub
Public Sub ImageToBytes(Image As Bitmap) As Byte()
Dim out As OutputStream
out.InitializeToBytesArray(0)
Image.WriteToStream(out, 100, "JPEG")
out.Close
Return out.ToBytesArray
End Sub