AVCaptureStillImageOutput Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AVFoundation.framework |
| Availability | Available in iOS 4.0 and later. |
| Companion guide | |
| Declared in | AVCaptureOutput.h |
Overview
AVCaptureStillImageOutput is a concrete sub-class of AVCaptureOutput that you use to capture a high-quality still image with accompanying metadata.
Tasks
Capturing an Image
Image Configuration
-
outputSettingsproperty -
availableImageDataCVPixelFormatTypesproperty -
availableImageDataCodecTypesproperty
Image Format Conversion
Properties
availableImageDataCodecTypes
The supported image codec formats that can be specified in outputSettings. (read-only)
Discussion
The value of this property is an array of NSString objects that you can use as values for the AVVideoCodecKey in the outputSettings property.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureOutput.havailableImageDataCVPixelFormatTypes
The supported image pixel formats that can be specified in outputSettings. (read-only)
Discussion
The value of this property is an array of NSNumber objects that you can use as values for the kCVPixelBufferPixelFormatTypeKey in the outputSettings property.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureOutput.hcapturingStillImage
Indicates whether a still image is being captured. (read-only)
Discussion
The value of this property is YES when a still image is being captured, and NO when no still image capture is underway.
You can observe the value of this property using key-value observing.
Availability
- Available in iOS 5.0 and later.
Declared In
AVCaptureOutput.houtputSettings
The compression settings for the output.
Discussion
You specify the compression settings using keys from AVVideoSettings.h, or a dictionary of pixel buffer attributes using keys from CVPixelBuffer.h.
Currently the only supported keys are AVVideoCodecKey and kCVPixelBufferPixelFormatTypeKey. The recommended values are kCMVideoCodecType_JPEG, kCVPixelFormatType_420YpCbCr8BiPlanarFullRange and kCVPixelFormatType_32BGRA.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureOutput.hClass Methods
jpegStillImageNSDataRepresentation:
Returns an NSData representation of a still image data and metadata attachments in a JPEG sample buffer.
Parameters
- jpegSampleBuffer
The sample buffer carrying JPEG image data, optionally with Exif metadata sample buffer attachments.
This method throws an
NSInvalidArgumentExceptionif jpegSampleBuffer isNULLor not in the JPEG format.
Return Value
An NSData representation of jpegSampleBuffer.
Discussion
This method merges the image data and Exif metadata sample buffer attachments without re-compressing the image.
The returned NSData object is suitable for writing to disk.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureOutput.hInstance Methods
captureStillImageAsynchronouslyFromConnection:completionHandler:
Initiates a still image capture and returns immediately.
Parameters
- connection
The connection from which to capture the image.
- handler
A block to invoke after the image has been captured. The block parameters are as follows:
- imageDataSampleBuffer
The data that was captured.
The buffer attachments may contain metadata appropriate to the image data format. For example, a buffer containing JPEG data may carry a
kCGImagePropertyExifDictionaryas an attachment. See ImageIO/CGImageProperties.h for a list of keys and value types.- error
If the request could not be completed, an
NSErrorobject that describes the problem; otherwisenil.
Discussion
This method returns immediately after it is invoked, later calling the provided completion handler block when image data is ready. If the request could not be completed, the error parameter will contain an NSError object describing the failure.
You should not assume that the completion handler will be called on a specific thread.
Availability
- Available in iOS 4.0 and later.
Declared In
AVCaptureOutput.h© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-10-12)