Returns an NSData
representation of a still image data and metadata attachments in a JPEG sample buffer.
SDKs
- iOS 4.0–10.0Deprecated
- macOS 10.7–10.15Deprecated
- Mac Catalyst 13.0–13.0Deprecated
Framework
- AVFoundation
Declaration
class func jpegStillImageNSDataRepresentation(_ jpegSampleBuffer: CMSample Buffer) -> Data?
Parameters
jpegSampleBuffer
The sample buffer carrying JPEG image data, optionally with
Exif
metadata sample buffer attachments.This method throws an
invalid
ifArgument Exception jpeg
isSample Buffer NULL
or not in the JPEG format.
Return Value
An NSData
representation of jpeg
.
Discussion
This method merges the image data and Exif
metadata sample buffer attachments without recompressing the image.
The returned NSData
object is suitable for writing to disk.