I am creating an app which open the photo gallery and a photo will be displayed in another activity by selecting that photo from the gallery. My problem is that the photos which I captured in portrait mode will be rotated after display. But the photos which I captured in landscape mode will be displayed correctly.
That's why, I have to check whether an image is captured in portrait mode or landscape mode using camera in android so that I can rotate the portrait captured photos. Can anyone help me how to do that?
N.B.: The width and height are same both in portrait captured image and landscape captured image.
You can always check the rotation of the image using Matrix and rotate it accordingly.
This code goes in onActivityResult-->
OnActivityResult Code Ends here.
This function below is used to get rotation:-