Private Sub BitmapToString(bmp As B4XBitmap) As String
Dim out As OutputStream
out.InitializeToBytesArray(1000)
bmp.WriteToStream(out, 100, "PNG")
out.Close
Dim su As StringUtils
Return su.EncodeBase64(out.ToBytesArray)
End Sub
Private Sub StringToBitmap(s As String) As B4XBitmap
Dim in As InputStream
Dim su As StringUtils
Dim b() As Byte = su.DecodeBase64(s)
in.InitializeFromBytesArray(b, 0, b.Length)
#if B4J
Dim img As Image
#else
Dim img As Bitmap
#end if
img.Initialize2(in)
Return img
End Sub