Android Question image is rotated when bitmap is loaded in the imageview

leitor79

Active Member
Licensed User
Longtime User
Hi,

B4X:
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
    If Success Then
        Dim bmp As Bitmap
        bmp.Initialize(Dir, FileName)
        imgFoto.Bitmap = bmp
    End If
.
.
.

The image in the chooser is shown right, no matter if the picture was taken portrait or landscape or if it is a screenshot.

I've tried using the ExifData library, but orientation returns always 0:

B4X:
Dim exif As ExifData
Dim sOrientation As String
exif.Initialize(Dir, FileName)
sOrientation = exif.getAttribute(exif.TAG_ORIENTATION)

I've checked here and here; It's correct to assume that if the orientation is 0, the picture has no orientation registered?

Thank you!
 

leitor79

Active Member
Licensed User
Longtime User
Thanks Erel, that seems to work (after trying 10 different pictures, none of the previous due to a device change)

Is there an explanation for this working with a copied file and not with the "original"?

Thank you very much!
 
Upvote 0

leitor79

Active Member
Licensed User
Longtime User
Thank you very much; I'm taking notes for some similar problem. I've noticed the "strange" path but I thought it could be manageable.

Thank you very much.
 
Upvote 0
Top