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


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 3 images, your callback is called 3 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-size 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.

Packaging Data for File Output

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 bracketed capture setting variations 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.


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.

class AVCapturePhotoOutput

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software