I want save image to camera roll in apple Watch
this is my code:
UIImage *image = [UIImage imageNamed:#"w0-1.jpg"];
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
can you help me please??
You cannot save image to saved photo album. You can only save image to your application folder.
Related
I am writing an app process image. But when I change alpha of an image to 0, it mean that this image will be transparent. And then I save this image to photo library.
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
But when I open this image again, i see that it has white background.
Does anybody know why?
Did you saved as jpeg?
try this:
NSData* pngdata = UIImagePNGRepresentation (image);
UIImage* img = [UIImage imageWithData:pngdata];
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
I want to save an image to camera roll with my own imagename in ios 5.I am using AV Foundation for accessing camera features.Please help me with possible solutions.
// Image to save
UIImage *img = [UIImage imageNamed:#"ImageName.png"];
// Request to save the image to camera roll
UIImageWriteToSavedPhotosAlbum(img, self,
#selector(image:didFinishSavingWithError:contextInfo:), nil);
Hope this helps..
Here i m trying to save image in gallery. i done this but now i want to save captured image in date wise folder in gallery.
- (IBAction)saveImage:(id)sender {
UIGraphicsBeginImageContextWithOptions(drawingSlate.bounds.size, drawingSlate.opaque, 0.0);
[drawingSlate.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
}
here the image is save in photos, but i want to save with proper name and datewise folder.
Thanks
In my main ViewController, I generate an image from UIGraphicsGetImageFromCurrentImageContext(). The image is assigned to a UIImage, and I've tested it by placing in a UIImageView in the main view, so I can see it. Works just fine. However when I tap a button I've assigned to save it, I get the error: -3304 "Failed to encode image for saved photos."
screenshot code:
CGSize mySize = CGSizeMake(530, 350);
UIGraphicsBeginImageContext(mySize);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, -444, -313);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
// self.screenshot is a UIImage declared in .h
self.screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Save code:
UIImageWriteToSavedPhotosAlbum(screenshot, self, #selector(imageWasSavedSuccessfully:didSaveWithError:contextInfo:), NULL);
Not sure if I'm not meeting the requirements for camera roll images, or if that method can only be used in conjunction with the UIPickerController class. Thanks for your help.
For posterity, the issue was that the image to be saved was nil.
Try to save your image like this:
UIImageWriteToSavedPhotosAlbum(screenshot, nil, nil, nil);
or maybe
UIImageWriteToSavedPhotosAlbum(self.screenshot, nil, nil, nil);
or maybe even
UIImageWriteToSavedPhotosAlbum(screenshot, self, nil, nil);
I've noticed that line drawings from the drawing app I'm making are very low quality when saved using this code:
UIImage *imageToSave = drawImage.image;
UIImageWriteToSavedPhotosAlbum(imageToSave, nil, nil, nil);
As far as I can understand, you can't set the JPG quality when using UIImageWriteToSavedPhotosAlbum.
Is there a way to save the UIImage as a PNG to the photo library directly, or some way to increase the JPG quality? When doing a screenshot (pressing on/off+home on the iPad) the quality of the grabbed picture is perfect, but I can't expect people to save images that way.
Any help greatly appreciated!
Try this
NSData* pngdata = UIImagePNGRepresentation (drawImage.image); //PNG wrap
UIImage* img = [UIImage imageWithData:pngdata];
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);