iphone - How to save image from NSData after doing the action of appendData? -
i want save image nsdata after appending additional bytes nsmutabledata. below sample code requirement.
nsdata *sourcedata = = uiimagejpegrepresentation([info objectforkey:@"uiimagepickercontrolleroriginalimage"], 1); nsmutabledata *concatenateddata = [nsmutabledata data]; [concatenateddata appenddata:sourcedata]; [concatenateddata appenddata:sourcedata]; uiimage *myfinalimage = [[uiimage alloc] initwithdata:concatenateddata]; uiimagewritetosavedphotosalbum(myfinalimage, self, nil, nil);
i appending sourcedata 2 times final image saving 1 sourcedata bytes.
am missing here?
here sample:
cgsize newsize = cgsizemake({here give width}, {here give height}); uiimage *myfinalimage1 = [[uiimage alloc] initwithdata:concatenateddata]; uiimage *myfinalimage2 = [[uiimage alloc] initwithdata:concatenateddata]; // set width height values. cgsize newsize = cgsizemake(width, height); uigraphicsbeginimagecontext( newsize ); [myfinalimage1 drawinrect:cgrectmake(0,0,newsize.width,newsize.height)]; [myfinalimage2 drawinrect:cgrectmake(newsize.width,newsize.height,newsize.width,newsize.height*2) blendmode:kcgblendmodenormal alpha:1.0]; uiimage *mergedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
Comments
Post a Comment