Class

AVCapturePhotoSettings

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

Declaration

class AVCapturePhotoSettings : NSObject

Overview

To take a photo, you create and configure a AVCapturePhotoSettings object, then pass it to the AVCapturePhotoOutput capturePhoto(with:delegate:) method.

A AVCapturePhotoSettings instance can include any combination of settings, regardless of whether that combination is valid for a given capture session. When you initiate a capture by passing a photo settings object to the AVCapturePhotoOutputcapturePhoto(with:delegate:) method, the photo capture output validates your settings to ensure deterministic behavior. For example, the flashMode setting must specify a value that is present in the photo output’s supportedFlashModes array. For detailed validation rules, see each property description below.

Topics

Creating Photo Settings

init(format: [String : Any]?)

Creates a photo settings object with the specified output format.

init(rawPixelFormatType: OSType)

Creates a photo settings object for RAW-format-only capture with the specified pixel format.

init(rawPixelFormatType: OSType, processedFormat: [String : Any]?)

Creates a photo settings object for capture in both RAW format and a processed format.

init(rawPixelFormatType: OSType, rawFileType: AVFileType?, processedFormat: [String : Any]?, processedFileType: AVFileType?)

Creates a photo settings object for capture in both RAW format and a processed format with the specified output file types.

var format: [String : Any]?

A dictionary describing the processed format (for example, JPEG) to deliver captured photos in.

var processedFileType: AVFileType?

The container file format for eventual output of the processed image.

var rawFileType: AVFileType?

The container file format for eventual output of the RAW image.

var rawPhotoPixelFormatType: OSType

An identifier for the Bayer RAW pixel format to deliver captured RAW photos in.

struct AVFileType

A uniform type identifier for various file formats.

Video Settings Dictionaries

Define output image and video formats by using the key and value constants.

Reusing Photo Settings

init(from: AVCapturePhotoSettings)

Creates a unique photo settings object, copying all settings values from the specified photo settings object.

Uniquely Identifying a Settings Object

var uniqueID: Int64

A unique identifier for this photo settings instance.

Enabling Preview and Thumbnail Delivery

var previewPhotoFormat: [String : Any]?

A dictionary describing the format for delivery of preview-sized images alongside the main photo.

var embeddedThumbnailPhotoFormat: [String : Any]?

A dictionary describing the format for delivery of thumbnail images embedded in photo file output.

var availableRawEmbeddedThumbnailPhotoCodecTypes: [AVVideoCodecType]

An array of video codec types compatible with the photo settings for embedding raw thumbnail images in photo file output.

var rawEmbeddedThumbnailPhotoFormat: [String : Any]?

A dictionary describing the format for delivery of raw thumbnail images embedded in photo file output.

var availableEmbeddedThumbnailPhotoCodecTypes: [AVVideoCodecType]

An array of video codec types compatible with the photo settings for embedding thumbnail images in photo file output.

var availablePreviewPhotoPixelFormatTypes: [OSType]

An array of available kCVPixelBufferPixelFormatTypeKeys available to specify a preview photo format.

Configuring Photo Settings

var flashMode: AVCaptureDevice.FlashMode

A setting for whether to fire the flash when capturing photos.

var isAutoRedEyeReductionEnabled: Bool

A Boolean value that determines whether to use auto red-eye reduction on flash captures.

var isHighResolutionPhotoEnabled: Bool

A Boolean value that specifies whether to capture still images at the highest resolution supported by the active device and format.

var isCameraCalibrationDataDeliveryEnabled: Bool

A Boolean value that determines whether a dual photo capture also delivers camera calibration data.

var photoQualityPrioritization: AVCapturePhotoOutput.QualityPrioritization

A setting that indicates how to prioritize photo quality against speed of photo delivery.

var isAutoVirtualDeviceFusionEnabled: Bool

A Boolean value that specifies whether to use automatic virtual-device image fusion.

var virtualDeviceConstituentPhotoDeliveryEnabledDevices: [AVCaptureDevice]

The constituent devices for which the virtual device should deliver photos.

var isAutoStillImageStabilizationEnabled: Bool

A Boolean value that specifies whether captures use automatic image stabilization.

Deprecated
var isAutoDualCameraFusionEnabled: Bool

A Boolean value that specifies whether captures automatically combine data from a dual camera device.

Deprecated
var isDualCameraDualPhotoDeliveryEnabled: Bool

A Boolean value that determines whether a dual camera device delivers images from both cameras.

Deprecated

Configuring Live Photo Settings

var livePhotoMovieFileURL: URL?

A URL at which to write Live Photo movie output.

var livePhotoMovieMetadata: [AVMetadataItem]!

A dictionary containing metadata to be included in the Live Photo movie file.

var livePhotoVideoCodecType: AVVideoCodecType

The video codec to use for encoding the movie portion of Live Photo output.

Capturing Depth Data

var isDepthDataDeliveryEnabled: Bool

A Boolean value that determines whether the photo output captures depth data along with the photo.

var embedsDepthDataInPhoto: Bool

A Boolean value that determines whether any depth data captured with the photo is included when generating output file data.

var isDepthDataFiltered: Bool

A Boolean value that determines whether to smooth noise and fill in missing values in depth data output.

Capturing Portrait Effects Matte

var isPortraitEffectsMatteDeliveryEnabled: Bool

Specifies whether a portrait effects matte should be captured along with the photo.

var embedsPortraitEffectsMatteInPhoto: Bool

Specifies whether the portrait effects matte captured with ths photo should be written to the photo's file structure.

Capturing Semantic Segmentation Mattes

var embedsSemanticSegmentationMattesInPhoto: Bool

A Boolean value that specifies whether to write the enabled semantic segmentation matte types captured with this photo to the photo’s file structure.

var enabledSemanticSegmentationMatteTypes: [AVSemanticSegmentationMatte.MatteType]

An array of semantic segmentation matte types that the photo render pipeline can deliver.

Embedding Metadata

var metadata: [String : Any]

A dictionary of metadata keys and values to embed in photo file output.

Relationships

Inherits From

See Also

Capturing a Photo

class AVCapturePhotoBracketSettings

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

class AVCaptureResolvedPhotoSettings

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