When I load an image from the media gallery into a Bitmap, everything is working fine, except that pictures that were shot with the camera while holding the phone vertically, are rotated so that I always get a horizontal picture even though it appears vertical in the gallery.
Why is that and how can I load it correctly?
Android: Bitmaps loaded from gallery are rotated in ImageView
androidbitmapgalleryrotation
Best Answer
So, as an example...
First you need to create an ExifInterface:
You can then grab the orientation of the image:
Here's what the orientation values mean: http://sylvana.net/jpegcrop/exif_orientation.html
So, the most important values are 3, 6 and 8. If the orientation is
ExifInterface.ORIENTATION_ROTATE_90
(which is 6), for example, you can rotate the image like this:That's just a quick example, though. I'm sure there are other ways of performing the actual rotation. But you will find those on StackOverflow as well.