Skip to content

Commit 85a02fa

Browse files
whispemEmilie
authored andcommitted
Improve photo quality with enhanced AVCapturePhotoOutput settings
- Set maxPhotoQualityPrioritization to .quality for AVCapturePhotoOutput - Set photoQualityPrioritization to .quality for each photo capture - Enable automatic red-eye reduction when supported Addresses issue #6098
1 parent 8d4c836 commit 85a02fa

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Signal/src/ViewControllers/Photos/CameraCaptureSession.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,12 +1486,15 @@ private class PhotoCapture {
14861486
let avCaptureOutput = AVCapturePhotoOutput()
14871487

14881488
var flashMode: AVCaptureDevice.FlashMode = .off
1489-
1490-
init() {
1489+
init() {
14911490
avCaptureOutput.isLivePhotoCaptureEnabled = false
14921491
avCaptureOutput.isHighResolutionCaptureEnabled = true
1493-
}
1492+
1493+
if #available(iOS 13.0, *) {
14941494

1495+
avCaptureOutput.maxPhotoQualityPrioritization = .quality
1496+
}
1497+
}
14951498
private var photoProcessors: [Int64: PhotoProcessor] = [:]
14961499

14971500
func takePhoto(delegate: PhotoCaptureDelegate, captureOrientation: AVCaptureVideoOrientation, captureRect: CGRect) {
@@ -1502,10 +1505,19 @@ private class PhotoCapture {
15021505

15031506
avCaptureConnection.videoOrientation = captureOrientation
15041507

1505-
let photoSettings = AVCapturePhotoSettings()
1508+
let photoSettings = AVCapturePhotoSettings()
15061509
photoSettings.flashMode = flashMode
15071510
photoSettings.isHighResolutionPhotoEnabled = true
15081511

1512+
if #available(iOS 13.0, *) {
1513+
1514+
photoSettings.photoQualityPrioritization = .quality
1515+
}
1516+
1517+
if avCaptureOutput.isAutoRedEyeReductionSupported {
1518+
photoSettings.isAutoRedEyeReductionEnabled = true
1519+
}
1520+
15091521
let photoProcessor = PhotoProcessor(delegate: delegate, captureRect: captureRect) { [weak self] in
15101522
self?.photoProcessors[photoSettings.uniqueID] = nil
15111523
}

0 commit comments

Comments
 (0)