convert an image to base64 in the compact frame work

G

Guest

I have a function to do this in the full frame work

Public Function BitmapToBase64(ByVal image As System.Drawing.Bitmap) As String
Dim base64 As String
Dim memory As New System.IO.MemoryStream
image.Save(memory, Imaging.ImageFormat.Bmp)
base64 = System.Convert.ToBase64String(memory.ToArray)
memory.Close()
memory = Nothing
Return base64
End Function

However the image class and the bitmap cllass do not have Save as a member.

As such I'm a little stuck as to how to get the image into the memory stream
so it can then be converted to base64.

If anyone has a way of doing this I'd be most appreciative of a solution.
 

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

Top