开发者

How to get the orientation of a Bitmap in Android

开发者 https://www.devze.com 2023-02-17 06:45 出处:网络
I want to get the orientation of bitmap images. I tried the following- Bitmap test = MediaStore.Images.Media.getBitmap(getContentResolver(), Uri);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消