imgToBase64

    <Extension()> _
    Public Function toBase64(ByVal img As Image) As String
        Try
            Dim ms As New System.IO.MemoryStream
            Dim arrImage() As Byte
            img.Save(ms, Imaging.ImageFormat.Bmp)
            arrImage = ms.GetBuffer
            Return Convert.ToBase64String(arrImage)

        Catch ex As Exception
            Return ""
        End Try
    End Function
Example:
img.toBase64

Description

converte imagem em base64

Details

Double click on the code to select all.

 

;