Android Example [B4X] Create Thumbnail and save it

Usage:
SavePictureToFile(XUIImageToJPEGByteArray(CreateThumbnail(xui.LoadBitmapResize(File.DirAssets,"Snapchat-248558753.jpg",150dip,150dip,True)),150dip,150dip,50),File.DirRootExternal,"test.jpg")
"quality" on "XUIImageToJPEGByteArray" results on a:
910kb image
quality = 50 = 17,69KB
quality = 100 = 100KB

SavePictureToFile:
Public Sub SavePictureToFile(Data() As Byte, Dir As String, FileName As String)
    Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
    out.WriteBytes(Data, 0, Data.Length)
    out.Close
End Sub
XUIImageToJPEGByteArray:
 
Top