Hello, I'm trying to replicate UIImagePickerController photo taking ability with AVFoundation. What I do:
- invoke `photoOutput.capturePhoto(with, delegate)
- in delegate method
photoOutput(_:didFinishProcessingPhoto:error:))
I retrieve UIImage withphoto.fileDataRepresentation()
The issue:
Produced UIImage has imageOrientation == .right
, always. At the same time if I use UIImagePickerController
, and say put my iPhone in landscape right position then produced image in its delegate has correct imageOrientation == .down
.
How can I achieve the same results with AVFoundation
given that my iPhone orientation is locked (so UIDevice.orientation
will not work). So far my best guess that I need to use accelerometer for this but maybe I miss some setting which allows to recover correct image orientation?
Thank you.