Android Question ImageView image orientation problem

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi all.

I took the photo with the camera in portrait mode. Uploaded this photo to my computer and opened it - still portrait mode but when I open the same photo in Image View it's in landscape. Is it possible to rate the photo in ImageView?
 

Alexander Stolte

Expert
Licensed User
Longtime User
B4X:
    Dim bmp As B4XBitmap = xui.LoadBitmap(File.DirAssets,"YourImage.jpg")
    Try
            Dim Exif As ExifData
            Exif.Initialize(Provider.SharedFolder, tempImageFile)
            Log("Orientation: " & Exif.getAttribute(Exif.TAG_ORIENTATION))
            Select Exif.getAttribute(Exif.TAG_ORIENTATION)
                Case Exif.ORIENTATION_ROTATE_180 '3
                    bmp = bmp.Rotate(180)
                Case Exif.ORIENTATION_ROTATE_90 '6
                    bmp = bmp.Rotate(90)
                Case Exif.ORIENTATION_ROTATE_270 '8
                    bmp = bmp.Rotate(270)
            End Select
    Catch
        Log(LastException)
    End Try
You need this lib:
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
B4X:
    Dim bmp As B4XBitmap = xui.LoadBitmap(File.DirAssets,"YourImage.jpg")
    Try
            Dim Exif As ExifData
            Exif.Initialize(Provider.SharedFolder, tempImageFile)
            Log("Orientation: " & Exif.getAttribute(Exif.TAG_ORIENTATION))
            Select Exif.getAttribute(Exif.TAG_ORIENTATION)
                Case Exif.ORIENTATION_ROTATE_180 '3
                    bmp = bmp.Rotate(180)
                Case Exif.ORIENTATION_ROTATE_90 '6
                    bmp = bmp.Rotate(90)
                Case Exif.ORIENTATION_ROTATE_270 '8
                    bmp = bmp.Rotate(270)
            End Select
    Catch
        Log(LastException)
    End Try
You need this lib:
Thank you for your reply. Doesn't work
It works:)
 
Upvote 0
Top