Skip to content

Commit 2dc3de7

Browse files
authored
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 2dc3de7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Signal/src/ViewControllers/Photos/CameraCaptureSession.swift

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,11 +1487,15 @@ private class PhotoCapture {
14871487

14881488
var flashMode: AVCaptureDevice.FlashMode = .off
14891489

1490-
init() {
1490+
init() {
14911491
avCaptureOutput.isLivePhotoCaptureEnabled = false
14921492
avCaptureOutput.isHighResolutionCaptureEnabled = true
1493-
}
1493+
1494+
if #available(iOS 13.0, *) {
14941495

1496+
avCaptureOutput.maxPhotoQualityPrioritization = .quality
1497+
}
1498+
}
14951499
private var photoProcessors: [Int64: PhotoProcessor] = [:]
14961500

14971501
func takePhoto(delegate: PhotoCaptureDelegate, captureOrientation: AVCaptureVideoOrientation, captureRect: CGRect) {
@@ -1502,10 +1506,19 @@ private class PhotoCapture {
15021506

15031507
avCaptureConnection.videoOrientation = captureOrientation
15041508

1505-
let photoSettings = AVCapturePhotoSettings()
1509+
let photoSettings = AVCapturePhotoSettings()
15061510
photoSettings.flashMode = flashMode
15071511
photoSettings.isHighResolutionPhotoEnabled = true
15081512

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

0 commit comments

Comments
 (0)