WWDC.ai

Implement high resolution photo capture

Use AVFoundation to capture 24MP and 48MP photos, choose RAW/bracketed/processed outputs, and keep camera apps responsive with prepared and deferred processing.

Watch on Apple Developer

TL;DR

  • High-resolution still capture requires the .photo session preset; 24MP and 48MP support depends on device camera, active format, requested dimensions, and quality prioritization.
  • AVFoundation supports fully processed photos, exposure brackets, Bayer RAW, and Apple ProRAW for different capture and editing workflows.
  • Configure AVCapturePhotoOutput.maxPhotoQualityPrioritization, choose maxPhotoDimensions from activeFormat.supportedMaxPhotoDimensions, and set matching per-capture AVCapturePhotoSettings.
  • Use prepared photo settings, responsive capture, deferred photo processing, and fast capture prioritization to reduce shot-to-shot delay during high-quality captures.

What "high resolution" means for iPhone capture

High-resolution photos provide more detail than the preview stream, which is only intended for on-screen camera display. They are useful for cropping, zooming, and image analysis, but require more memory and processing time.

The session distinguishes typical 12MP high-resolution capture from 24MP and 48MP modes. 48MP capture uses a full-resolution frame from the Quad sensor for maximum detail. 24MP capture combines a 12MP multi-frame fused HDR image with a 48MP full-resolution image through the Photonic Engine, producing more detail than 12MP while keeping file size more manageable than full 48MP.

  • 48MP Quad sensor support starts with iPhone 14 Pro and iPhone 14 Pro Max.
  • 24MP photo capture starts with iPhone 15 and is the default in the Camera app on supported devices.
  • 24MP and 48MP support extends to the Tele camera on iPhone 16 Pro and the Ultra Wide camera on iPhone 17.
  • Higher resolutions improve detail and flexibility, but increase processing cost and capture latency.

Choose the capture type for the workflow

AVFoundation can request several high-resolution capture types. The right choice depends on whether the app wants a finished computational photo, inputs for HDR selection, or editable sensor data.

  • Fully processed photos are multi-frame fused and processed by the Photonic Engine to improve dynamic range and fine detail.
  • Exposure brackets capture multiple exposures of the same scene for HDR workflows or selection among different exposures.
  • Bayer RAW provides minimally processed sensor data for custom post-processing and editing workflows.
  • Apple ProRAW combines RAW flexibility with iPhone image processing for more control over exposure, color, and detail during editing.

Configure the capture session and photo output

Use an AVCaptureSession with the .photo preset for 24MP and 48MP capture. Other session presets do not support these resolutions.

Configure AVCapturePhotoOutput before committing the session configuration. Changing key photo-output settings after commit can trigger a lengthy pipeline reconfiguration.

  • Set maxPhotoQualityPrioritization according to the highest quality level the session should support: speed, balanced, or quality.
  • Query device.activeFormat.supportedMaxPhotoDimensions on iOS 16 and later, then choose dimensions that fit the app's use case rather than always choosing the largest size.
  • Set photoOutput.maxPhotoDimensions before commitConfiguration().
  • High-resolution availability can depend on maxPhotoQualityPrioritization.

Configure a photo session

Use the photo preset, configure output quality prioritization, choose supported dimensions from the active format, and commit once configuration is complete.

import AVFoundation

private let session = AVCaptureSession()
private let photoOutput = AVCapturePhotoOutput()

private func configureSession() {
    session.beginConfiguration()
    session.sessionPreset = .photo

    photoOutput.maxPhotoQualityPrioritization = .quality // or .balanced

    let supported = device?.activeFormat.supportedMaxPhotoDimensions ?? []
    if let largest = supported.max(by: { lhs, rhs in
        Int(lhs.width) * Int(lhs.height) < Int(rhs.width) * Int(rhs.height)
    }) {
        photoOutput.maxPhotoDimensions = largest
    }

    session.commitConfiguration()
    session.startRunning()
}

Request dimensions and quality per capture

For each photo request, set maxPhotoDimensions and photoQualityPrioritization on AVCapturePhotoSettings. This lets one session support multiple dimensions and quality levels without reconfiguring the capture pipeline between shots.

maxPhotoDimensions is a request, not a guarantee. The system considers light level, scene conditions, and available processing resources. The actual delivered dimensions are reported through AVCaptureResolvedSettings.

  • 12MP capture is available across speed, balanced, and quality prioritization levels.
  • 48MP capture is available with balanced or quality prioritization because it is a single-frame capture.
  • 18MP and 24MP multi-frame fused captures require quality prioritization.
  • The 18MP case discussed is for the Center Stage front camera on iPhone 17.

Capture with requested dimensions and quality

Set the requested dimensions and quality on the capture settings for the current shot, then inspect resolved settings in the delegate for the actual result.

import AVFoundation

let settings = AVCapturePhotoSettings()
settings.maxPhotoDimensions = dimension.cmVideoDimensionsValue
settings.photoQualityPrioritization = .quality

if let delegate {
    photoOutput?.capturePhoto(with: settings, delegate: delegate)
}

Prepare resources before high-resolution capture

High-resolution captures require resource allocation based on dimensions and quality prioritization. If those resources are not prepared ahead of time, allocation happens during capture and can slow down the shutter response.

Use setPreparedPhotoSettingsArray when entering a mode such as 48MP capture. The settings used later for the actual capture must be a new AVCapturePhotoSettings object whose configuration matches the prepared settings.

  • Prepare as early as possible after the user activates a high-resolution mode.
  • Do not reuse the prepared settings object for the actual capture.
  • Match maxPhotoDimensions and photoQualityPrioritization between prepared and capture settings.

Preallocate for a high-resolution mode

Prepare the expected high-resolution pipeline ahead of time, then create a separate matching settings object for capture.

import AVFoundation

let prepareSettings = AVCapturePhotoSettings()
prepareSettings.maxPhotoDimensions = photoOutput.maxPhotoDimensions
prepareSettings.photoQualityPrioritization = .quality

photoOutput.setPreparedPhotoSettingsArray([prepareSettings]) { prepared, error in
    if let error {
        print("Failed to prepare: \(error)")
        return
    }
    print("Pipeline prepared: \(prepared)")
}

// Later, create new settings with a matching configuration.
let captureSettings = AVCapturePhotoSettings()
captureSettings.maxPhotoDimensions = photoOutput.maxPhotoDimensions
captureSettings.photoQualityPrioritization = .quality
photoOutput.capturePhoto(with: captureSettings, delegate: self)

Keep capture responsive

High-resolution photo processing can take several seconds. AVCapturePhotoCaptureDelegate callbacks report capture and processing progress, and AVCaptureResolvedSettings.photoProcessingTimeRange provides an estimate for when the photo will be delivered.

Without responsive capture, the next shot must wait for the previous photo to finish processing. Enabling responsive capture allows the next capture to begin after the previous capture stage completes, even while processing continues. Observe AVCapturePhotoOutput.captureReadiness to know when another photo can be captured.

Deferred photo processing improves responsiveness further by delivering a lightly processed proxy shortly after capture, then completing final processing later on demand through the photo library or in the background when system conditions are favorable. Fast capture prioritization can adapt rapid-fire quality captures down to balanced quality; starting with iOS 27 on iPhone 16 and iPhone 17, balanced fast captures can also be processed later using deferred processing.

  • Use responsive capture to overlap the capture stage of a new photo with processing of the previous photo.
  • Use deferred photo processing for high-quality captures so processing no longer blocks the next capture for as long.
  • Use fast capture prioritization when the app should favor responsiveness during bursts of quick captures.
  • Expect each photo's final processing work to still take time; these features reduce blocking and shot-to-shot delay, not the total work needed for final image quality.

Resources

Unofficial, not associated with Apple. BySuperwall

On this page

Ask AI