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


class AVCapturePhoto : NSObject


When you capture photos with the AVCapturePhotoOutput class, your delegate object receives each resulting image and related data in the form of an AVCapturePhoto object. This object is an immutable wrapper from which you can retrieve various results of the photo capture.

In addition to the photo image pixel buffer, an AVCapturePhoto object can also contain a preview-sized pixel buffer, capture metadata, and, on supported devices, depth data and camera calibration data. From an AVCapturePhoto object, you can generate data appropriate for writing to a file, such as HEVC encoded image data containerized in the HEIC file format and including a preview image, depth data and other attachments.

An AVCapturePhoto instance wraps a single image result. For example, if you request a bracketed capture of three images, your callback is called three times, each time delivering a single AVCapturePhoto object.


Resolving Photo Capture Requests

var resolvedSettings: AVCaptureResolvedPhotoSettings

The settings object that was used to request this photo capture.

var photoCount: Int

The 1-based index of this photo capture relative to other results from the same capture request.

var timestamp: CMTime

The time at which the image was captured.

Accessing Photo Pixel Data

var isRawPhoto: Bool

A Boolean value indicating whether this photo object contains RAW format data.

var pixelBuffer: CVPixelBuffer?

The uncompressed or RAW image sample buffer for the photo, if requested.

Accessing Preview Photo Data

var embeddedThumbnailPhotoFormat: [String : Any]?

A dictionary describing the data format for a preview-sized image accompanying the captured photo.

var previewPixelBuffer: CVPixelBuffer?

The pixel data for a preview-sized version of the photo, if requested.

Accessing Photo Metadata

var depthData: AVDepthData?

Depth or disparity map data captured with the photo.

class AVDepthData

A container for per-pixel distance or disparity information captured by compatible camera devices.

var cameraCalibrationData: AVCameraCalibrationData?

Calibration information for the camera device that captured the photo.

class AVCameraCalibrationData

Information about the camera characteristics used to capture images and depth data.

var sourceDeviceType: AVCaptureDevice.DeviceType?

The type of device that captured the photo.

var metadata: [String : Any]

A dictionary of metadata describing the captured image.

var portraitEffectsMatte: AVPortraitEffectsMatte?

The portrait effects matte captured with the photo.

Packaging Data for File Output

protocol AVCapturePhotoFileDataRepresentationCustomizer

A set of delegate callbacks to be implemented by callers of fileDataRepresentation(with:).

func fileDataRepresentation() -> Data?

Generates and returns a flat data representation of the photo and its attachments.

func cgImageRepresentation() -> Unmanaged<CGImage>?

Extracts and returns the captured photo's primary image as a Core Graphics image object.

func previewCGImageRepresentation() -> Unmanaged<CGImage>?

Extracts and returns the captured photo's preview image as a CoreGraphics image object.

Examining Bracketed Capture Information

var bracketSettings: AVCaptureBracketedStillImageSettings?

The variations available for bracketed capture settings for this photo.

var sequenceCount: Int

The 1-based index of this photo in a bracketed capture sequence.

var lensStabilizationStatus: AVCaptureDevice.LensStabilizationStatus

Information about the use of lens stabilization during bracketed photo capture.

enum AVCaptureDevice.LensStabilizationStatus

Constants that indicate the status of optical image stabilization hardware during a bracketed photo capture.

Accessing Segmentation Mattes


Inherits From

Conforms To

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.

class AVCapturePhotoOutput

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

protocol AVCapturePhotoCaptureDelegate

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