简体   繁体   English

使用原生iOS相机应用拍摄的照片始终是UIImageOrientationUp

[英]Photos taken with native iOS Camera app are always UIImageOrientationUp

I'm working on building a test case of all possible image and video orientations taken with the iPhone. 我正在努力构建一个使用iPhone拍摄的所有可能图像和视频方向的测试用例。

I've used the native iOS camera app to shoot all 8 possible orientations (UP, DOWN, LEFT, RIGHT) yet for the sample code I'm running it all seems to reporting that the images are 我已经使用原生的iOS相机应用程序来拍摄所有8个可能的方向(向上,向下,向左,向右)但是我正在运行的示例代码似乎都报告图像是

Reference code is printOrientationForName(@“UIImage”, image.imageOrientation); 参考代码是printOrientationForName(@“UIImage”, image.imageOrientation); Working example can be found here sugarso/Orientation 可以在这里找到工作示例sugarso / Orientation

Output is here 输出在这里

2014-05-04 15:42:39.651 Orientation[10293:60b] ASSET ALAsset - Type:Photo, URLs:assets-library://asset/asset.JPG?id=E819189D-0696-4C94-8046-804CBF1551E8&ext=JPG
2014-05-04 15:42:39.661 Orientation[10293:60b] UIImage UIImageOrientationUp [0]
2014-05-04 15:42:39.663 Orientation[10293:60b] ASSET ALAsset - Type:Photo, URLs:assets-library://asset/asset.JPG?id=19E29D06-96F2-4B35-A0EB-B2A809A02C79&ext=JPG
2014-05-04 15:42:39.665 Orientation[10293:60b] UIImage UIImageOrientationUp [0]
2014-05-04 15:42:39.667 Orientation[10293:60b] ASSET ALAsset - Type:Photo, URLs:assets-library://asset/asset.JPG?id=265261C0-0479-41C4-BFDC-91AD6887A81F&ext=JPG
2014-05-04 15:42:39.668 Orientation[10293:60b] UIImage UIImageOrientationUp [0]
2014-05-04 15:42:39.669 Orientation[10293:60b] ASSET ALAsset - Type:Photo, URLs:assets-library://asset/asset.JPG?id=BE459DAE-0CFD-4D93-8050-5C62D9F5D0F9&ext=JPG
2014-05-04 15:42:39.670 Orientation[10293:60b] UIImage UIImageOrientationUp [0]

As you can see, all the images are created with UIImageOrientationUp. 如您所见,所有图像都是使用UIImageOrientationUp创建的。 I'm examining the wrong property? 我正在检查错误的财产? Or is the camera app flips all the photos? 或者相机应用翻转所有照片? How should I be taking photos with the given layout. 我应该如何使用给定的布局拍照。

Depends on different things, for instance: 取决于不同的事情,例如:

  • if you do not save them on the asset library along with their metadata and later you open them, they will load with the default orientation (UIImageOrintationUp) 如果您不将它们与元数据一起保存在资产库中,稍后打开它们,它们将加载默认方向(UIImageOrintationUp)
  • if you save them as png, images don't have a knowledge about their orientation 如果将它们保存为png,则图像不了解其方向
  • the orientation is different if you load/shoot them with the picker, or delegate buffer, or still images 如果使用拾取器,委托缓冲区或静止图像加载/拍摄它们,方向会有所不同

I wrote this post on my blog ( Exif pain ), maybe it will help to check your issue 我在我的博客上写了这篇文章( Exif痛苦 ),也许这有助于检查你的问题

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

相关问题 用相机拍摄的照片的磅数-iPhone 5或6(iOS 8) - Size in Points of photos taken with camera - iPhone 5 or 6 (iOS 8) 如何将使用iOS SDK拍摄的照片添加到用户的相机胶卷中? - How to add photos taken with the iOS SDK to the user's camera roll? 将其他相机拍摄的 DNG(原始照片)保存到 iOS 照片库 - Saving DNG (raw photos) taken on other camera to iOS Photo Library iOS上的MLKit文本检测适用于从Assets.xcassets拍摄的照片,但不适用于在相机上拍摄的同一照片/从相机胶卷上传的照片 - MLKit Text detection on iOS working for photos taken from Assets.xcassets, but not the same photo taken on camera/uploaded from camera roll Xamarin iOS 相机和照片 - Xamarin iOS camera and photos 使用Photos Framework获取相机拍摄的照片的URL - Getting the URL of picture taken by camera with Photos Framework 用前置摄像头拍摄的照片上水印显得更大 - Watermark appears bigger on photos taken with the front camera 使用相机拍摄的iOS裁剪图像 - iOS cropping image taken with camera iOS:将相机照片放入NSMutableArray - iOS: Put camera photos to NSMutableArray 本机 iOS 应用程序与 WebView 不要求相机权限 - Native iOS app with WebView not asking for camera permissions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM