728x90
Image to Base64 String
- Public Function ImageToBase64(image As Image, format As System.Drawing.Imaging.ImageFormat) As String
- Using ms As New MemoryStream()
- ' Convert Image to byte[]
- image.Save(ms, format)
- Dim imageBytes As Byte() = ms.ToArray()
- ' Convert byte[] to Base64 String
- Dim base64String As String = Convert.ToBase64String(imageBytes)
- Return base64String
- End Using
- End Function
Base64 String to Image
- Public Function Base64ToImage(base64String As String) As Image
- ' Convert Base64 String to byte[]
- Dim imageBytes As Byte() = Convert.FromBase64String(base64String)
- Dim ms As New MemoryStream(imageBytes, 0, imageBytes.Length)
- ' Convert byte[] to Image
- ms.Write(imageBytes, 0, imageBytes.Length)
- Dim image__1 As Image = Image.FromStream(ms, True)
- Return image__1
- End Function
728x90
'자료' 카테고리의 다른 글
C# Selenium Webdriver alert창 Enter하기 (0) | 2020.06.15 |
---|---|
메이플스토리 NGS 우회 (0) | 2020.06.15 |
VB.net 클래스 호출 (0) | 2020.06.05 |
DD 키코드 정리 (0) | 2020.06.04 |
VB.net Flat UI 폼소스 (0) | 2020.06.03 |