Selected image from ImagePicker1/Photos or camera in portrait mode with wrong orientation

When I select am image for the iOS photo library or camera via ImagePicker, the orientation of photos in portrait format are rotated.

Sub Selected(pic as Picture) Handles Selected

var g as grahics =
g.DrawPicture pic 0, 0
End Sub

Is there any way to check the orientation of picture “pic”.

it’s not actually. the problem is that the image is stored with a rotation attribute that you cannot access. We’ve already got a feature request to make that information available.

if the orientation info is Exif, and you have the monkeybread plugins, this code taken from my windows app may help… you will need to adjust some syntax

          var gorig as new GMImageMBS(f)
         var a_pic as picture
          a_pic = gorig.CopyPicture
          orient = gorig.attributeValue("EXIF:Orientation")

          if  orient = "6"  then // "Needs rotation by 90"
            gorig.rotate 90
            a_pic = gorig.CopyPicture
          end if
          if  orient = "3"  then // "Needs rotation by 180"
            gorig.rotate 180
            a_pic = gorig.CopyPicture
          end if
          if  orient = "8"  then //"Needs rotation by -90"
            gorig.rotate -90
            a_pic = gorig.CopyPicture
          end if
       //  "Problem getting EXIF data.. fallback to just using the file."
        end try

I have worked around this issue by showing a rotate button next to the picture when it is selected.

1 Like

I have try out this code, but it is not working. I have picked the same picture on iPad and on iPhone. with iPad the picture is correct, but with iPhone the picture is rotated and it is also rotated, when the picture format is HEIC.

Oh well.