ios - What`s the compression ratio of NSData from AVCaptureStillImageOutput? -
use jpegstillimagensdatarepresentation
: method can nsdata
avcapurestillimageoutput
, can write data file.
nsdata * imagedata = [avcapturestillimageoutput jpegstillimagensdatarepresentation:imagesamplebuffer];
just imagesamplebuffer
turn nsdata
. can compression radio in method, or there index measure this?
just uiimagejpegrepresentation(uiimage* image, 1.0)
this, has 1.0 measure compression radio image.
you can control compression (0-1) used avcapturestillimageoutput.
[stillimageoutput setoutputsettings:@{avvideocodeckey : avvideocodecjpeg, avvideoqualitykey:@1.0}];
see avcaptureoutput.h , avvideosettings.h: avvideoqualitykey supported on ios 6.0 , later , may used when avvideocodeckey set avvideocodecjpeg. avvideoqualitykey nsnumber (0.0-1.0, jpeg only)
you can verify key works looking @ size of data different values. default value don't think it's 1.0 because when set 1.0 size bumps bit , didn't setup tripod attempt take same pic....
Comments
Post a Comment