Fix image orientation

pull/531/head
Ryan Zhao 4 years ago
parent 13b7b1edb6
commit 2cb006c3e4

@ -593,7 +593,11 @@ class PhotoCaptureOutputAdaptee: NSObject, ImageCaptureOutput {
@available(iOS 11.0, *) @available(iOS 11.0, *)
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) { func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
let data = photo.fileDataRepresentation()! var data = photo.fileDataRepresentation()!
// Call normalized here to fix the orientation
if let srcImage = UIImage(data: data) {
data = srcImage.normalized().jpegData(compressionQuality: 1.0)!
}
DispatchQueue.main.async { DispatchQueue.main.async {
self.delegate?.captureOutputDidFinishProcessing(photoData: data, error: error) self.delegate?.captureOutputDidFinishProcessing(photoData: data, error: error)
} }

@ -166,7 +166,7 @@ public class ImageEditorCanvasView: UIView {
// of code simplicity. We could modify the image layer's // of code simplicity. We could modify the image layer's
// transform to handle the normalization, which would // transform to handle the normalization, which would
// have perf benefits. // have perf benefits.
return srcImage.normalized() return srcImage
} }
// MARK: - Content // MARK: - Content

Loading…
Cancel
Save