i am doing the following to convert images to a string From the camera
every thing seems to work but the phone is lagging too much while this procedures begins , any idea on how to enhance the performance of current code to avoid lagging freezing ?
B4X:
Sub camera_Preview(Data() As Byte)
Dim sendtime As Long
sendtime = DateTime.Now
If sendtime - lastsendtimecam >= 500 Then
Dim jpeg() As Byte = camera1.PreviewImageToJpeg(Data, 20)
Dim rot As Int = camera1.CurrOrient
Dim ins As InputStream
Dim bmp As Bitmap
Dim bmpresize As Bitmap
ins.InitializeFromBytesArray(jpeg, 0, jpeg.Length)
bmp.Initialize2(ins)
ins.Close
bmp = RotateImage(bmp, rot)
bmpresize = CreateScaledBitmap(bmp,320, 240)
Dim imagetostring As String
Dim imgbyets() As Byte
imgbyets = imagetobyets(bmpresize)
imagetostring = strutls.EncodeBase64(imgbyets)
'do send if needed
lastsendtimecam = DateTime.Now
End If
End Sub
every thing seems to work but the phone is lagging too much while this procedures begins , any idea on how to enhance the performance of current code to avoid lagging freezing ?