Skip to content

Conversation

@whispem
Copy link

@whispem whispem commented Oct 26, 2025

Summary

This PR improves photo quality in Signal's custom camera by leveraging iOS computational photography APIs available through AVFoundation.

Changes

  • Set maxPhotoQualityPrioritization to .quality on AVCapturePhotoOutput initialization
  • Set photoQualityPrioritization to .quality for each photo capture
  • Enable automatic red-eye reduction when supported by the device

Motivation

Addresses #6098 - Users reported that photos taken with Signal's custom camera are significantly lower quality compared to the native iOS Camera app. While the custom camera cannot access all features like Night Mode, Portrait Mode, or Cinematic Mode (which require UIImagePickerController), these improvements maximize photo quality using the available AVFoundation APIs.

Technical Details

  • Uses @available(iOS 13.0, *) checks for quality prioritization APIs
  • photoQualityPrioritization = .quality enables better image processing including:
    • Improved noise reduction
    • Better color accuracy
    • Enhanced dynamic range
    • Optimized sharpness
  • High-resolution capture remains enabled
  • Compatible with existing flash and orientation settings

Testing

  • Tested on various iOS devices (recommended: test in low-light conditions)
  • Verified no performance regression in capture speed
  • Confirmed backward compatibility with iOS 13+

Limitations

This approach improves quality within the custom camera architecture but doesn't provide access to advanced modes like Night Mode or Portrait Mode, which would require adopting UIImagePickerController (a larger architectural change as noted in #6098).

Fixes #6098

var flashMode: AVCaptureDevice.FlashMode = .off

init() {
init() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: seems there are some formatting errors

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ianrahmin for catching that! I see the indentation issues on lines 1490 and 1509. I'll fix the formatting to match Signal's style (4 spaces) and push an update. Apologies for the oversight!

avCaptureConnection.videoOrientation = captureOrientation

let photoSettings = AVCapturePhotoSettings()
let photoSettings = AVCapturePhotoSettings()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@castiel652
Copy link

Can you the indentation commit into the main commit :)

- Set maxPhotoQualityPrioritization to .quality for AVCapturePhotoOutput
- Set photoQualityPrioritization to .quality for each photo capture
- Enable automatic red-eye reduction when supported

Addresses issue signalapp#6098
@whispem whispem force-pushed the improve-photo-quality branch from fabdbb0 to 85a02fa Compare November 5, 2025 08:58
@whispem
Copy link
Author

whispem commented Nov 5, 2025

Can you the indentation commit into the main commit :)

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom camera provides a significantly lower photo quality compared to the native iOS camera.

3 participants