VB.NET Base64 To Image


/ Published in: VB.NET
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.