Posted By

mracoker on 02/01/10


Tagged

image VBNet base64


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

D4RKCODE


VB.NET Base64 To Image


 / Published in: VB.NET
 

  1. Function Base64ToImage(ByVal base64string As String) As System.Drawing.Image
  2. 'Setup image and get data stream together
  3. Dim img As System.Drawing.Image
  4. Dim MS As System.IO.MemoryStream = New System.IO.MemoryStream
  5. Dim b64 As String = base64string.Replace(" ", "+")
  6. Dim b() As Byte
  7.  
  8. 'Converts the base64 encoded msg to image data
  9. b = Convert.FromBase64String(b64)
  10. MS = New System.IO.MemoryStream(b)
  11.  
  12. 'creates image
  13. img = System.Drawing.Image.FromStream(MS)
  14.  
  15. Return img
  16. End Function

Report this snippet  

You need to login to post a comment.