How to get the orientation of a Bitmap in Android
I want to get the orientation of bitmap images. I tried the following-
Bitmap test = MediaStore.Images.Media.getBitmap(getContentResolver(), Uri);
int w = test.getWidth();
int h = test.getHeight();
However开发者_如何学JAVA it returns w=2592 & h=1944 (for all images captured by the camera) irrespective of whether it was taken in landscape or portrait mode. Is this the correct approach or is there any better way to do this?
You need to use ExifInterface if you are using API level 5 or higher. See this post.
精彩评论