Class

AVCapturePhoto

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

Overview

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.

Topics

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()

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

func cgImageRepresentation()

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

func previewCGImageRepresentation()

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 lens stabilization (optical image stabilization) hardware during a bracketed photo capture.

Relationships

Inherits From

Conforms To

See Also

Photo Capture

class AVCapturePhotoOutput

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