i see this sub in cameraex
can i set a custom scaled size during the compression to jpeg ? i dont want to convert each frame to bitmap to resize can i do it directly in this function ?
B4X:
Public Sub PreviewImageToJpeg(data() As Byte, quality As Int) As Byte()
Dim size, previewFormat As Object
r.target = parameters
size = r.RunMethod("getPreviewSize")
previewFormat = r.RunMethod("getPreviewFormat")
r.target = size
Dim width = r.GetField("width"), height = r.GetField("height") As Int
Dim yuvImage As Object = r.CreateObject2("android.graphics.YuvImage", _
Array As Object(data, previewFormat, width, height, Null), _
Array As String("[B", "java.lang.int", "java.lang.int", "java.lang.int", "[I"))
r.target = yuvImage
Dim rect1 As Rect
rect1.Initialize(0, 0, r.RunMethod("getWidth"), r.RunMethod("getHeight"))
Dim out As OutputStream
out.InitializeToBytesArray(100)
r.RunMethod4("compressToJpeg", Array As Object(rect1, quality, out), _
Array As String("android.graphics.Rect", "java.lang.int", "java.io.OutputStream"))
Return out.ToBytesArray
End Sub
can i set a custom scaled size during the compression to jpeg ? i dont want to convert each frame to bitmap to resize can i do it directly in this function ?