Type Method


Returns data in JPEG format corresponding to the captured photo in the specified sample buffer.


+ (NSData *)JPEGPhotoDataRepresentationForJPEGSampleBuffer:(CMSampleBufferRef)JPEGSampleBuffer previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer;



A sample buffer containing the JPEG photo capture result to be formatted for output.


An optional additional sample buffer containing a preview-resolution version of the photo capture result, to be added to the JPEG output as a thumbnail image. Pass nil to skip adding a preview image to the output.

Return Value

A data object containing a JPEG representation of the requested photo capture results, or nil if the sample buffers cannot be packaged for output.


After you request a photo capture with the capturePhotoWithSettings:delegate: method, the photo capture output delivers results to your delegate as one or more CMSampleBufferRef objects. (See the captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error: method.) To repackage the sample buffer’s content for output as a JPEG file, use this class method. Optionally, you can include metadata in the resulting JPEG output by attaching it to the sample buffer before calling this method.

See Also

Getting Formatted Output Data

+ DNGPhotoDataRepresentationForRawSampleBuffer:previewPhotoSampleBuffer:

Returns data in digital negative (DNG) format corresponding to the captured RAW photo in the specified sample buffer.