I am currently using these 2 libraries:
1 - https://www.b4x.com/android/forum/t...tends-the-camera-library-functionality.23801/
2 - https://www.b4x.com/android/forum/threads/camera2-still-images-and-videos.83920/
When I take a picture and record the orientation through the function RotateJpegIfNeeded, the orientation is always "6" no matter what.
So when the function runs, the picture only has 1 correct orientation.
Anyone else has the same problem? Is it the phone? or Am I doing something wrong?
The phone's SDK Ver is 29
The camera's supported hardware is: LEVEL_3
1 - https://www.b4x.com/android/forum/t...tends-the-camera-library-functionality.23801/
2 - https://www.b4x.com/android/forum/threads/camera2-still-images-and-videos.83920/
When I take a picture and record the orientation through the function RotateJpegIfNeeded, the orientation is always "6" no matter what.
So when the function runs, the picture only has 1 correct orientation.
B4X:
Public Sub RotateJpegIfNeeded (bmp As B4XBitmap, Data() As Byte) As B4XBitmap
Dim p As Phone
If p.SdkVersion >= 24 Then
Log("Phone SDK Ver: " & p.SdkVersion)
Dim ExifInterface As JavaObject
Dim in As InputStream
in.InitializeFromBytesArray(Data, 0, Data.Length)
ExifInterface.InitializeNewInstance("android.media.ExifInterface", Array(in))
Dim orientation As Int = ExifInterface.RunMethod("getAttribute", Array("Orientation"))
Log("Picture Orientation: " & orientation) 'This always returns 6
Select orientation
Case 3 '180
bmp = bmp.Rotate(180)
Case 6 '90
bmp = bmp.Rotate(90)
Case 8 '270
bmp = bmp.Rotate(270)
End Select
in.Close
End If
Return bmp
End Sub
Anyone else has the same problem? Is it the phone? or Am I doing something wrong?
The phone's SDK Ver is 29
The camera's supported hardware is: LEVEL_3