前后设备相机照片捕捉意图中的图像旋转错误 [英] Image rotation error in front and rear device camera photo capture intent

查看:158
本文介绍了前后设备相机照片捕捉意图中的图像旋转错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下设备相机意图捕获并将图像保存在设备存储中:

HI i have used the following device camera intent to capture and save the image in device storage:

        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE,lastChar);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
        // Start the image capture Intent
        startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);  

Everthing工作正常,相机捕捉图像,正确保存到存储中,但是当我我试图通过从存储中提取图像uri并在imageview中显示它来查看图像。
图像角度一直在变化。
用于后置摄像头拍摄的图像旋转角度为90度,前置摄像头拍摄图像旋转角度为270度。

Everthing is just working fine , camera capturing the image ,saving it into the storage properly, but when i am trying to view the image by fetching image uri from storage and displaying it in the imageview. Image angle changing all the time. for Rear camera captured image rotation angle is 90 degree and for front camera capture image rotation angle is 270 degree.

我为所有图像添加了90度旋转,解决后凸轮问题,但前置摄像头拍摄的图像仍然有180度旋转。

i have added 90 degree rotation to all images , that resolving the rear camra problem , but front camera captured image still have the 180 degree rotation .

提前感谢,请帮我解决这个问题

thanks in advance , please help me sorting out this issue

推荐答案

有些相机实际上会以适当的旋转方式存储JPEG图像;其他人将设置一个EXIF标题,要求图像查看器旋转图像。 ImageView 不支持JPEG文件中的EXIF标头。您将需要使用 ExifInterface (或类似技术)来查看是否有EXIF方向标题并调整您的图像以适应。

Some cameras will actually store JPEG images in the proper rotation; others will set an EXIF header asking the image viewer to rotate the image. ImageView does not honor EXIF headers in JPEG files. You will need to use ExifInterface (or similar techniques) to see if there is an EXIF orientation header and adjust your image to suit.

这篇关于前后设备相机照片捕捉意图中的图像旋转错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆