iphone - Getting image from image picker causes memory warning -


i working on app requires both thumbnail version , compressed full version of image selected uiimagepickercontroller. when selecting relatively large image (such taken iphone 4s camera), receive memory warning. cannot determine whether or not resizing algorithm or getting image picker. can done prevent this? there must solution, simple photo picker used in countless apps.

- (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info {      //show progress hud while image retrieved      [svprogresshud showwithstatus:@"getting picture" masktype:svprogresshudmasktypegradient];      dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_high, 0), ^{          uiimage *originalimage = [info objectforkey:@"uiimagepickercontrolleroriginalimage"];          //currentimage = [originalimage scaletosize:cgsizemake(100.0f, 100.0f)];          cgsize size = cgsizemake(51, 43);         uigraphicsbeginimagecontext(size);         [originalimage drawinrect:cgrectmake(0, 0, 51, 43)];         currentimage = uigraphicsgetimagefromcurrentimagecontext();         uigraphicsendimagecontext();          compressedfullimage = uiimagepngrepresentation(originalimage);          imagehasbeenselected = yes;          dispatch_async(dispatch_get_main_queue(), ^{              [picker dismissmodalviewcontrolleranimated:yes];             [svprogresshud dismiss];         });     }); } 


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -