//Creating a Graphics contextUigraphicsbeginimagecontext (Cgsizemake ( $, $)); Cgcontextref Context=Uigraphicsgetcurrentcontext (); UIImage*image = [UIImage imagenamed:@"1.png"]; [Image Drawinrect:cgrectmake (0,0, $, $)]; //Add WatermarkNSString *str =@"My Pictures"; [Str drawinrect:cgrectmake (Ten,Ten, -, the) Withattributes:@{nsfontattributename:[uifont Boldsystemfontofsize: -],nsforegroundcolorattributename:[uicolor Redcolor]}]; //get a picture from the current drawing context (turn the current drawing context into a picture)UIImage *changeimage =Uigraphicsgetimagefromcurrentimagecontext (); //Freeing Memorycgcontextrelease (context); //Freeing MemoryUigraphicsendimagecontext (); NSLog (@"%f", Uiimagepngrepresentation (changeimage). length/1024x768. f); Uiimageview*imageview = [[Uiimageview alloc]initwithframe:cgrectmake ( -, -, ChangeImage.size.width, ChangeImage.size.height)]; Imageview.image=Changeimage; [Self.view Addsubview:imageview]; //Save to album (requires incoming callback method, callback method format is required)Uiimagewritetosavedphotosalbum (Changeimage, Self, @selector (image:error:contextInfo:), nil);- (void) Image: (UIImage *) Image error: (Nserror *) Error ContextInfo: (cgcontextref) context{if(Error) {NSLog (@"Save failed! "); } Else{NSLog (@"Save success! "); }}
Save pictures to albums