Can anyone tell me how to use the UIImagePickerController (camera and album) delegates determine the image's orientation, rotate accordingly, and assign it to a UIImageView?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- How to write CUSTOM metadata into JPEG with Python
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
Vodkhang's answer is partially incorrect - modern cameras put an explicit orientation into the image when they take the photo. This has been common for about 5+ years now.
I've previously used the code in this answer to do the rotation by reading the "orientation" info direct from the picture:
UIImagePickerController camera preview is portrait in landscape app
Note:
UIImageView
reads theimageOrientation
property and displaysUIImage
accordingly.No, UIImagePickerController cannot do it explicitly.
If you want to determine based on image's content. It is kind of hard problem. How can you determine an image's orientation without understanding the content inside of it?
I can suggest you a trick that you examine the width and the length of the returned image and see if it is portrait or landscape. For rotating the image, there are some libraries and codes outside but I didn't try them much. You can take a look at this blog