Maxim Veksler
Maxim Veksler

Reputation: 30222

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.

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

Reference code is printOrientationForName(@“UIImage”, image.imageOrientation); Working example can be found here 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. 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.

Upvotes: 0

Views: 612

Answers (1)

Andrea
Andrea

Reputation: 26383

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)
  • if you save them as png, images don't have a knowledge about their orientation
  • 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

Upvotes: 2

Related Questions