-3

Hey i'm working on a project and i want to send an image from a server to a client.

How do i convert the picture from GdiPlus bitmap to string.

Thanks for helping.

1 Answers1

0

I guess you could you get bytes from bitmap (or file) and convert them to a base64 string. The way is simple: just get data from image saving to memory and then convert to Base64.

Dim Stream As IO.MemoryStream
Dim Buffer As Byte() = New Byte() {}
Dim ImageString As String

Stream = New IO.MemoryStream()
Imagen.Save(Stream, System.Drawing.Imaging.ImageFormat.Png)
Buffer = Stream.GetBuffer()
Stream.Close()

ImageString = System.Convert.ToBase64String(Buffer)

Are you working on unmanaged code? C# or VB.net?

Hope it helps!

ZeroWorks
  • 1,618
  • 1
  • 18
  • 22