B borofan Member Licensed User Longtime User Nov 8, 2014 #1 hey, anybody worked out how to encode a bitmap to a base64 string in b4i? Last edited: Nov 8, 2014
Erel B4X founder Staff member Licensed User Longtime User Nov 9, 2014 #2 It is the same as in B4A: B4X: Sub ImageToBase64(img As Bitmap) As String Dim su As StringUtils Dim out As OutputStream out.InitializeToBytesArray(0) img.WriteToStream(out, 100, "JPEG") Return su.EncodeBase64(out.ToBytesArray) End Sub Upvote 0
It is the same as in B4A: B4X: Sub ImageToBase64(img As Bitmap) As String Dim su As StringUtils Dim out As OutputStream out.InitializeToBytesArray(0) img.WriteToStream(out, 100, "JPEG") Return su.EncodeBase64(out.ToBytesArray) End Sub