memory leaks - iPhone 4S is unable to handle full resolution from AVCaptureSessionPresetPhoto -
i've been developing project on iphone 4s , iphone5. in project, after picture taken, crop , resize image apply photo filters. iphone 5 seems handle on iphone 4s, seems crash @ different points during picture taking process. checked see if there we're memory leaks may have missed. here code below:
[stillimageoutput capturestillimageasynchronouslyfromconnection:videoconnection completionhandler: ^(cmsamplebufferref imagesamplebuffer, nserror *error) { [capturesession stoprunning]; nsdata *imagedata = [avcapturestillimageoutput jpegstillimagensdatarepresentation:imagesamplebuffer]; uiimage *newimage = [[uiimage alloc] initwithdata:imagedata];
after this, automatically detect orientation of picture taken , rotate picture upright.
after this, crop image square using nyximageskit
float filteringsquareratio = 307.0/320.0; uiimage *cropped = [newimage croptosize:cgsizemake(filteringsquareratio * newimage.size.width, filteringsquareratio * newimage.size.width) usingmode:nyxcropmodecenter];
lastly, resize image using mgimageutilities
uiimage *resized = [cropped imagescaledtofitsize:cgsizemake(320, 320)];
is there better way this? i'm using avcapturesessionpresetphoto because save original high resolution photo on device , send cropped , resized version server. don't want use of video presets because camera zoomed in. can causing crashing?
if weren't able find solution (i see problem too), perhaps detect 4s , use "high" preset instead has lower resolution.
Comments
Post a Comment