简体   繁体   English

以人像拍摄的照片被横向保存

[英]Photos taken in portrait are being saved in landscape

I've been trying to use the Android ACTION_IMAGE_CAPTURE intent and ACTION_GET_CONTENT intent to either take a photo or pick one. 我一直在尝试使用Android ACTION_IMAGE_CAPTURE意向和ACTION_GET_CONTENT意向拍摄照片或选择照片。 The problem I'm having is that when I when I try to take a photo using the Android photo intent in portrait mode, it saves it in landscape orientation. 我遇到的问题是,当我尝试使用人像模式下的Android照片意图拍摄照片时,它将以横向保存。

I'm trying to save the Bitmap of the correctly orientated photo from a URI string. 我正在尝试从URI字符串中保存正确定位的照片的Bitmap

I found this question: Android Camera Intent Saving Image Landscape When Taken Portrait , which is the exact same problem I'm having, but the answer is incomplete and didn't work for me. 我发现了这个问题: 拍摄人像时Android相机意图保存图像风景 ,这与我遇到的问题完全相同,但是答案不完整,对我不起作用。 For example, what is the resizedBitmap , opts , and is file Uri.getPath() ? 例如,什么是resizedBitmapopts以及file Uri.getPath()

Well some cameras lock the landscape mode as default mode of camera(Samsung note 2) so if you take a picture in potrait mode the image is still saved in landscape mode. 好吧,有些相机将风景模式锁定为默认相机模式(三星注释2),因此,如果您在纵向模式下拍摄照片,图像仍会保存为风景模式。 Most of the camera will add metadata into the image like the camera vendor, model,etc. 大多数相机都会将元数据添加到图像中,例如相机供应商,型号等。 Amongst various metadata that can be present the one we are intrested in is the rotation data. 可以呈现的各种元数据中有一个是旋转数据。 It specifies by what degrees the image is to be rotated. 它指定图像旋转的角度。 For knowing the rotation you can use ExifInterface class. 要了解旋转情况,可以使用ExifInterface类。

resizedBitmap Images are stored as bitmap objects in android. resizedBitmap图像在Android中存储为位图对象。 As an image can be large loading them whole into memory can lead to outofmemory error's and make your app consume more memory. 由于图像可能很大,因此将它们全部加载到内存中可能会导致内存不足错误,并使您的应用程序占用更多内存。 So a bitmap is first resized to appropriate size and then loaded into memory. 因此,首先将位图调整为适当的大小,然后再加载到内存中。

opts By opts you must be referring to BitmapFactory.Options method. opts通过opts必须引用BitmapFactory.Options方法。 It is a class that provides methods to change the behaviour of bitmaps like making it mutable(is set to true you can apply effects like grayscale to this bitmap) , find its height and width in pixels without loading it to RAM,etc. 这是一个提供更改位图行为的方法的类,例如使其可变(设置为true,可以将灰度等效果应用于此位图),以像素为单位查找其高度和宽度而无需将其加载到RAM等。

file Its a class used to perform CRUD operations in any file stored in the system. 文件它是用于在系统中存储的任何文件中执行CRUD操作的类。

Uri.getPath() this method returns the path where your image is stored or null. Uri.getPath()此方法返回存储图像的路径或为null。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以人像模式从相机拍摄的加载到画布上的照片为横向 - Photos loaded onto canvas taken from a camera in portrait mode are landscape 检测视频是否以纵向/横向拍摄 - Detecting if video was taken in portrait/landscape 即使以肖像拍摄,三星机器人拍摄的图库图像也始终处于风景中 - Gallery images taken on Samsung androids always in landscape even if taken in portrait Camera API-人像图像另存为风景 - Camera API - Portrait image is saved as landscape 纵向模式图像被requestCameraImage保存为横向模式 - portrait mode image saved as landscape mode by requestCameraImage 如何检查照片是在Android的横向还是纵向模式下拍摄的? - How to check whether the photo was taken in landscape or portrait mode in Android? 在人像模式下拍摄的图像应在android中保留为横向模式 - image taken when in portrait mode should retain in landscape mode in android 以人像然后以横向模式连续拍照时,应用程序崩溃 - Application crashes when taking photos successively in portrait then in landscape mode 以人像模式拍摄的照片是否沿逆时针方向旋转保存? - Picture taken on portrait mode is saved rotated counter clockwise? 确保照片以与拍摄时相同的方向保存? - Make sure photos are saved with the same orientation they were taken?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM