Class

AVCapturePhotoOutput

A capture output for still image, Live Photo, and other photography workflows.

Declaration

@interface AVCapturePhotoOutput : AVCaptureOutput

Overview

AVCapturePhotoOutput provides a modern interface for capture workflows related to still photography. In addition to basic capture of still images, a photo output supports RAW-format capture, bracketed capture of multiple images, Live Photos, and wide-gamut color. You can output captured photos in a variety of formats and codecs, including RAW format DNG files, HEVC format HEIF files, and JPEG files.

To capture photos with the AVCapturePhotoOutput class, follow these steps:

  1. Create an AVCapturePhotoOutput object. Use its properties to determine supported capture settings and to enable certain features (for example, whether to capture Live Photos).

  2. Create and configure an AVCapturePhotoSettings object to choose features and settings for a specific capture (for example, whether to enable image stabilization or flash).

  3. Capture an image by passing your photo settings object to the capturePhotoWithSettings:delegate: method along with a delegate object implementing the AVCapturePhotoCaptureDelegate protocol. The photo capture output then calls your delegate to notify you of significant events during the capture process.

Some photo capture settings, such as the flashMode property, include options for automatic behavior. For such settings, the photo output determines whether to use that feature at the moment of capture—you don’t know when requesting a capture whether the feature will be enabled when the capture completes. When the photo capture output calls your AVCapturePhotoCaptureDelegate methods with information about the completed or in-progress capture, it also provides an AVCaptureResolvedPhotoSettings object that details which automatic features have been set for that capture. The resolved settings object’s uniqueID property matches the uniqueID value of the AVCapturePhotoSettings object you used to request capture.

Enabling certain photo features (Live Photo capture and high resolution capture) requires a reconfiguration of the capture render pipeline. To opt into these features, set the highResolutionCaptureEnabled, livePhotoCaptureEnabled, and livePhotoAutoTrimmingEnabled properties before calling your AVCaptureSession object’s startRunning method. Changing any of these properties while the session is running disrupts the capture render pipeline: Live Photo captures in progress end immediately, unfulfilled photo requests abort, and video preview temporarily freezes.

Using a photo capture output adds other requirements to your AVCaptureSession object:

The AVCapturePhotoOutput class implicitly supports wide-gamut color photography. If the source AVCaptureDevice object’s activeColorSpace value is AVCaptureColorSpace_P3_D65, the capture output produces photos with wide color information (unless your AVCapturePhotoSettings object specifies an output format that does not support wide color).

Topics

Creating a Photo Output

- init

Initializes a new photo capture output object.

+ new

Creates a new photo capture output object.

Capturing a Photo

- capturePhotoWithSettings:delegate:

Initiates a photo capture using the specified settings.

AVCapturePhotoSettings

A specification of the features and settings to use for a single photo capture request.

AVCapturePhotoBracketSettings

A specification of the features and settings to use for a photo capture request that captures multiple images with varied settings.

AVCaptureResolvedPhotoSettings

A description of the features and settings in use for an in-progress or complete photo capture request.

Choosing Data and File Formats

availablePhotoFileTypes

The list of file types currently supported for photo capture and output.

availableRawPhotoFileTypes

The list of file types currently supported for RAW format capture and output.

- supportedPhotoCodecTypesForFileType:

Returns the list of photo codecs (such as JPEG or HEVC) supported for photo data in the specified file type.

- supportedPhotoPixelFormatTypesForFileType:

Returns the list of uncompressed pixel formats supported for photo data in the specified file type.

- supportedRawPhotoPixelFormatTypesForFileType:

Returns the list of Bayer RAW pixel formats supported for photo data in the specified file type.

availablePhotoPixelFormatTypes

The pixel formats this capture output currently supports for photo capture.

availablePhotoCodecTypes

The compression codecs this capture output currently supports for photo capture.

availableRawPhotoPixelFormatTypes

The pixel formats this capture output currently supports for RAW photo capture.

Determining Available Settings

stillImageStabilizationSupported

A Boolean value indicating whether the capture output currently supports automatic stabilization for still image capture.

Deprecated
dualCameraFusionSupported

A Boolean value indicating whether the capture output currently supports automatically combining image data on a dual camera device.

Deprecated
maxBracketedCapturePhotoCount

The maximum number of images that the photo capture output can support in a single bracketed capture.

lensStabilizationDuringBracketedCaptureSupported

A Boolean value indicating whether the capture output currently supports lens stabilization during bracketed image capture.

supportedFlashModes

The flash settings this capture output currently supports.

autoRedEyeReductionSupported

A Boolean value indicating whether the capture output supports automatic red-eye reduction.

Monitoring the Visible Scene

isFlashScene

A Boolean value indicating whether the scene currently being previewed by the camera warrants use of the flash.

isStillImageStabilizationScene

A Boolean value indicating whether the scene currently being previewed by the camera warrants image stabilization.

Deprecated
photoSettingsForSceneMonitoring

A photo settings object that controls how the photo output detects and handles automatic flash and stabilization modes.

Configuring High-Resolution Still Capture

highResolutionCaptureEnabled

A Boolean value that specifies whether to configure the capture pipeline for high resolution still image capture.

Configuring Live Photo Capture

livePhotoCaptureSupported

A Boolean value indicating whether the capture output currently supports Live Photo capture.

livePhotoCaptureEnabled

A Boolean value that specifies whether to configure the capture pipeline for Live Photo capture.

livePhotoCaptureSuspended

A Boolean value that specifies whether to suspend, but not disable, Live Photo capture.

livePhotoAutoTrimmingEnabled

A Boolean value that specifies whether to automatically trim Live Photo movie captures to avoid excessive movement.

availableLivePhotoVideoCodecTypes

The list of video codecs currently available for capturing Live Photos with the photo output.

Configuring Depth Data Capture

depthDataDeliverySupported

A Boolean value indicating whether the capture output currently supports depth data capture.

depthDataDeliveryEnabled

A Boolean value that specifies whether to configure the capture pipeline for depth data capture.

Configuring Portrait Effects Matte Capture

portraitEffectsMatteDeliveryEnabled

A Boolean value indicating whether the capture output will generate a portrait effects matte.

portraitEffectsMatteDeliverySupported

A Boolean value indicating whether the capture output currently supports delivery of a portrait effects matte.

portraitEffectsMatte

The portrait effects matte captured with the photo.

Configuring Dual Camera Capture

dualCameraDualPhotoDeliverySupported

A Boolean value indicating whether the capture output currently supports simultaneous photo capture with both cameras on a dual-camera device.

Deprecated
cameraCalibrationDataDeliverySupported

A Boolean value indicating whether the capture output currently supports delivery of camera calibration data.

dualCameraDualPhotoDeliveryEnabled

A Boolean value that specifies whether to configure the capture pipeline for simultaneous photo capture with both cameras on a dual-camera device.

Deprecated

Preparing for Resource-Intensive Captures

preparedPhotoSettingsArray

An array of photo settings for which the photo output has prepared capture resources.

- setPreparedPhotoSettingsArray:completionHandler:

Tells the photo capture output to prepare resources for future capture requests with the specified settings.

Getting Formatted Output Data

+ JPEGPhotoDataRepresentationForJPEGSampleBuffer:previewPhotoSampleBuffer:

Returns data in JPEG format corresponding to the captured photo in the specified sample buffer.

Deprecated
+ DNGPhotoDataRepresentationForRawSampleBuffer:previewPhotoSampleBuffer:

Returns data in digital negative (DNG) format corresponding to the captured RAW photo in the specified sample buffer.

Deprecated

Getting Segmentation Mattes

availableSemanticSegmentationMatteTypes

An array of semantic segmentation matte types that may be captured and delivered along with the primary photo.

enabledSemanticSegmentationMatteTypes

The semantic segmentation matte types that the photo render pipeline delivers.

Setting the Capture Prioritization

maxPhotoQualityPrioritization

The highest quality the photo output should prepare to deliver on a capture-by-capture basis.

AVCapturePhotoQualityPrioritization

Constants that indicate how to prioritize photo quality relative to capture speed.

Relationships

Inherits From

See Also

Photo Capture

Capturing Still and Live Photos

Configure and capture single or multiple still images, Live Photos, and other forms of photography.

Supporting Continuity Camera in Your Mac App

Incorporate scanned documents and pictures taken with a user's iPhone, iPad, or iPod touch into your Mac app using Continuity Camera.

AVCapturePhoto

A container for image data collected by a photo capture output.

AVCapturePhotoCaptureDelegate

Methods for monitoring progress and receiving results from a photo capture output.