ACTION_IMAGE_CAPTURE orientation problem on Nexus S and Samsung Galaxy S I9000

懵懂的女人 提交于 2019-12-04 05:13:59

From what I can tell, this is happening because the MediaStore.Images.ImageColumns.ORIENTATION value isn't being set by this Intent. It does get set when things come through the normal camera app.

On my Nexus S, however, the file still gets the correct EXIF data. So you could get the orientation like this:

ExifInterface exif = new ExifInterface("filepath");
exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                     ExifInterface.ORIENTATION_NORMAL);

Then you could use use ContentResolver.update add the correct ORIENTATION data. You just need to translate the ExifInterface orientation options to degrees rotated.

Your other option is to create your own Activity to operate the camera hardware and record the file. You'd then keep track of rotations & write the value into the metadata when saving a captured image. Since the Camera app is part of Android, you could probably copy & modify it without too much pain.

I have expereienced this issue also on the Samsung phones, including the Galaxy Ace, (I called the camera action an entirely different method from yours)

My guess is that this is the OS/hardware level issue. Have you tried taking a picture using the native camera application, and managed it to get the correct orientation in that app?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!