I have UIImagePicker to select the image. After selecting the image I am editing it and now I want to save that image.
Can anyone please tell me how can I save the image to Photo Album?
I have UIImagePicker to select the image. After selecting the image I am editing it and now I want to save that image.
Can anyone please tell me how can I save the image to Photo Album?
You can use this function
UIImageWriteToSavedPhotosAlbum(UIImage *yourImage, id completionTarget, SEL completionSelector, void *contextInfo);
See the answer to this question...And about completionTarget and completionSelector, from documentation...
The use of the completionTarget, completionSelector, and contextInfo parameters is optional and necessary only if you want to be notified asynchronously when the function finishes writing the image to the user’s Camera Roll or Saved Photos album. If you do not want to be notified, pass nil for these parameters.
take a look at this tutorial
here is my code to get image if the image is edited then edited image will be taken into account.
if not edited then original image will be taken
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
UIImage *image;
if (picker.editing == YES) {
image = [info objectForKey:@"UIImagePickerControllerEditedImage"];
}
else {
image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
// [picker release];
// [self dismissModalViewControllerAnimated:YES];
}