From 85a02fa7ceb6e2fd04d24bf6fde8af4389b335c3 Mon Sep 17 00:00:00 2001 From: Em Date: Sun, 26 Oct 2025 23:26:40 +0100 Subject: [PATCH] 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 --- .../Photos/CameraCaptureSession.swift | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/Photos/CameraCaptureSession.swift b/Signal/src/ViewControllers/Photos/CameraCaptureSession.swift index 3804235b639..e234f1dde1c 100644 --- a/Signal/src/ViewControllers/Photos/CameraCaptureSession.swift +++ b/Signal/src/ViewControllers/Photos/CameraCaptureSession.swift @@ -1486,12 +1486,15 @@ private class PhotoCapture { let avCaptureOutput = AVCapturePhotoOutput() var flashMode: AVCaptureDevice.FlashMode = .off - - init() { +init() { avCaptureOutput.isLivePhotoCaptureEnabled = false avCaptureOutput.isHighResolutionCaptureEnabled = true - } + + if #available(iOS 13.0, *) { + avCaptureOutput.maxPhotoQualityPrioritization = .quality + } + } private var photoProcessors: [Int64: PhotoProcessor] = [:] func takePhoto(delegate: PhotoCaptureDelegate, captureOrientation: AVCaptureVideoOrientation, captureRect: CGRect) { @@ -1502,10 +1505,19 @@ private class PhotoCapture { avCaptureConnection.videoOrientation = captureOrientation - let photoSettings = AVCapturePhotoSettings() + let photoSettings = AVCapturePhotoSettings() photoSettings.flashMode = flashMode photoSettings.isHighResolutionPhotoEnabled = true + if #available(iOS 13.0, *) { + + photoSettings.photoQualityPrioritization = .quality + } + + if avCaptureOutput.isAutoRedEyeReductionSupported { + photoSettings.isAutoRedEyeReductionEnabled = true + } + let photoProcessor = PhotoProcessor(delegate: delegate, captureRect: captureRect) { [weak self] in self?.photoProcessors[photoSettings.uniqueID] = nil }