Android Question CamEx2 image rotated 90 degrees

I am using the CamEx2 library in some phones the resulting bitmap is good but in some phones the resulting bitmap is rotated by 90 degrees wherein the bottom of the image is located on the left. What could be the solution for this? Many thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Use SMM to load the image. It will automatically handle the exif orientation setting.

 
Upvote 0
What i mean is that when i take a picture using CamEx2 It will produce a data as byte. The problem is the image in that byte is already rotated and not the imageview causing it to rotate. How can i resolve wherein the produced byte is always in portrait orientation at all devices?
 
Upvote 0
B4X:
Sub TakePicture
    Try
        SetState(openstate, True, VideoMode)
        Wait For(cam.FocusAndTakePicture(MyTaskIndex)) Complete (Data() As Byte)
        SetState(openstate, False, VideoMode)
        cam.DataToFile(Data, VideoFileDir, "1.jpg")
        imgbyte = Data
        Dim bmp As B4XBitmap = cam.DataToBitmap(Data)
    Catch
        HandleError(LastException)
    End Try
    
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It happens when the camera creates a jpeg image where the image itself is rotated and the correct orientation is set in the exif headers.
SMM will load the images correctly, unlike LoadBitmap which ignores the headers.
 
Upvote 0

michw

Member
Licensed User
Longtime User
I am using the CamEx2 library in some phones the resulting bitmap is good but in some phones the resulting bitmap is rotated by 90 degrees wherein the bottom of the image is located on the left. What could be the solution for this? Many thanks

did you fix the issue with rotated camera image after save?
I have the same problem and I don't know how to fix it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…