pnlCurrent.Visible = False
Try
File.Delete(xui.DefaultFolder, "2.jpg")
Catch
Log(LastException)
End Try
Log("File.Exists=" & File.Exists(xui.DefaultFolder , "1.jpg"))
smm.SetMediaFromFile(pnlCurrent, xui.DefaultFolder , "1.jpg", "image/jpeg", CreateMap(smm.REQUEST_RESIZE_MODE:"FILL_HEIGHT", smm.REQUEST_CALLBACK: Me))
Wait For (pnlCurrent) SMM_MediaReady (Success As Boolean, Media As SMMedia)
Dim b4xmvp As B4XBitmap = Media.Media
Dim Out As OutputStream = File.OpenOutput(xui.DefaultFolder, "2.jpg", False)
b4xmvp.WriteToStream(Out, 100, "JPEG")
#if b4a
Out.Flush
#end if
Out.Close
Dim bmp As B4XBitmap = b4xmvp
Dim xDim As Int = 320
Dim yDim As Int = bmp.Height * xDim / bmp.Width
bmp = xui.LoadBitmapResize(xui.DefaultFolder, "2.jpg", xDim, yDim, True)
Return bmp