Return to Snippet

Revision: 23240
at February 2, 2010 00:14 by mracoker


Updated Code
Function Base64ToImage(ByVal base64string As String) As System.Drawing.Image
        'Setup image and get data stream together
        Dim img As System.Drawing.Image
        Dim MS As System.IO.MemoryStream = New System.IO.MemoryStream
        Dim b64 As String = base64string.Replace(" ", "+")
        Dim b() As Byte
    
        'Converts the base64 encoded msg to image data
        b = Convert.FromBase64String(b64)
        MS = New System.IO.MemoryStream(b)
   
        'creates image
        img = System.Drawing.Image.FromStream(MS)
        
        Return img
    End Function

Revision: 23239
at February 1, 2010 15:47 by mracoker


Initial Code
byte[] bytes;

bytes = Convert.FromBase64String(baseString64);

System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);

System.Drawing.Image img = System.Drawing.Image.FromStream(ms);

Initial URL

                                

Initial Description

                                

Initial Title
VB.NET Base64 To Image

Initial Tags
image

Initial Language
VB.NET