B4J Question Base64

moore_it

Well-Known Member
Licensed User
Longtime User
Hi,
can I save the contents of a canvas in a BASE64 string?

thanks in advance
 

XbNnX_507

Active Member
Licensed User
Longtime User
B4X:
    Dim img As Image =    canvas.Snapshot2 ( fx.Colors.Transparent ) '<- canvas to image
    Dim out As OutputStream
    out.InitializeToBytesArray( 0 )
    img.WriteToStream( out )
    Dim encoded As String = su.EncodeBase64( out.ToBytesArray )
    File.WriteString( File.DirApp, "base64Image.txt", encoded ) ' <- creates a textFile 
    Log ( encoded ) '<- show the actual encoded text
     out.Close

Hope it Helps.
 
Upvote 0
Top