Save UIImage into a specific PhotoAlbum - iphone

Is it possible to create a folder into a photo album where i can save my UIImage?
I use - UIImageWriteToSavedPhotosAlbum but i can't chose the specific Photo Album

Not possible with the current SDK (4.1 and lower).

Related

Camera Roll asset images not available after saving an image to Saved Photos

I am using ALAssetsLibrary to make an array of all images in the camera roll when my iPhone app starts. I store every image as a ALAsset * in an array.
Later in the app, I am saving an image to the gallery using this:
UIImageWriteToSavedPhotosAlbum(croppedImage, self, #selector(image:didFinishSavingWithError:contextInfo:), nil);
The image is saved successfully to the saved photos album. But, now my problem is that when I try to retrieve images using the existing array of all images, I don't get anything. Do I need to build the array of all images again or is there some other way to do this?
Saving an image changes the library and invalidates objects like assets from the library. You need to reload assets from the library whenever the library changes - do that when you receive an ALAssetsLibraryChangedNotification.

How to obtain a copied image from the pasteboard?

I have a photo editing app where I want to provide a way for the user to edit photos from the pasteboard. For example the user might copy a photo from his website in Safari and then head over to my app and choose "Open from pasteboard". Kind of like Photoshop does it.
How can I get notified or check if there is a picture or graphic (probably a UIImage) in the pasteboard? And how could I obtain that image?
I needed one for a UIImage and this snippet helped me out.
You can always extract the image out using:
UIImage *image = [UIPasteboard generalPasteboard].image;

Save a UIImage to a different name

I am writing an application which lets the user pick one photograph from a selection. Then I want to save that photograph to their photo roll to a specific name. i.e I always want the photo in the roll to be named the same thing and overwrite previous selections.
UIImage* image = [UIImage imageNamed:[ImageNames objectAtIndex:self.miImage]];
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
I can't find anyway to make a copy of the image and assign a new name to it, or specify a target name for UIImageWriteToSavedPhotosAlbum().
Is there any way to do this?
thanks in advance,
Jay
You cannot specify a filename when using UIImageWriteToSavedPhotosAlbum because it saves the image to the Camera Roll (or the Photos Library, if the device does not have a camera). This allows the system to assign it a name based on a format, like "DSC0001.jpg" or similar, and avoid name collisions.
Because of this, overwriting an image is also not possible, since the Photo Library / Camera Roll are controlled by the user - a user that would not appreciate a photo being overwritten by your application.
...writing the image to the user’s Camera Roll or Saved Photos album.
UIImageWriteToSavedPhotosAlbum Reference

iPhone rewrite image file

I would like to access an image file in the iPhone images directory.
Then I would like to open this file as binary and be able to rewrite it.
Assuming user has chosen this file using the UIImagePickerController, is it possible to do such thing using iPhone API?
http://developer.apple.com/library/ios/#DOCUMENTATION/AudioVideo/Conceptual/CameraAndPhotoLib_TopicsForIOS/Articles/PickinganItemfromthePhotoLibrary.html this tutorial will help you in getting UIImage from photo library.
Once you obtain the image, you can do custom modifications to the UIImage and save it to photo album using this API:
Adds the specified image to the user’s Camera Roll album.
void UIImageWriteToSavedPhotosAlbum (
UIImage *image,
id completionTarget,
SEL completionSelector,
void *contextInfo
);
If you are looking to replace the existing photo from Photo library , there is no direct (or Apple Approved) way to do that. If you still want to do that, you can find path to photo library (/private/var/mobile/Media/DCIM/100APPLE) and try rewriting the photos.

Retrieving an iPhone photo saved to the photo library

I am saving images to the photo library and would like to retrieve them dynamically to display in future launches of my app. I use the WriteToSavedPhotosAlbum function, as below, but do not get any info to access the saved photo programmatically.
UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);
Once saved, is there a way to retrieve the file name/id and load an image from the photo library at a later time?
You just need to save them for yourself.
Possibly in your app's documents or cache folder.
As a side note, when you say: "display at launch", if you mean to replace the Default.png, that won't work.
The launch image must be static and included in your app bundle.
If not, disregard.
You can't, unless the user picks the photo using the UIImagePickerController.
Check this related question
try this code segment make the necessay changes
UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=pickerDelegate;
picker.sourcetype=UIImagepickerControllerSourceTypePhtoLibrary;