How to save images in camera roll in iphone programmatically? - iphone

I am developing one application. In that I want to save my pictures in camera roll. So how to save my pictures in camera roll through code?

The most basic way (and the only way if you're targeting iOS before 4.0) is to use UIImageWriteToSavedPhotosAlbum. This lets you specify a selector to be called on a target object when the save is complete.
In 4.0, you can use ALAssetsLibrary's writeImageToSavedPhotosAlbum:orientation:completionBlock: to write the image; in this case, you provide a block to be called when the save is complete.
In 4.1, you can also use ALAssetsLibrary's writeImageDataToSavedPhotosAlbum:metadata:completionBlock: or writeImageToSavedPhotosAlbum:metadata:completionBlock: to write an image along with metadata (e.g. geotagging information). The former is also the only way to write an image from an NSData object without first loading it as a UIImage or CGImageRef.

See this blog post..UIImageWriteToSavedPhotosAlbum is your friend..

Related

How to iterate over all videos stored in camera roll?

Is there a way to iterate over all videos stored in camera roll? I want to list them in a table view, and when you tap one you see the metadata.
Where would I start?
If you want to list them in a table view, it sounds like you don't want to use Apple's UIImagePickerController.
In that case, you need to go down to the lower-level API's.
For example, you can use ALAssetsLibrary's [enumerateGroupsWithTypes: usingBlock: failureBlock:] to get at all of your ALAsset objects in your camera roll. As your app looks at each ALAsset, you need to make certain the ALAsset url is a video (and this related question shows you how).

iPhone: get image from camera without UIImagePickerController

Please help me with my question.
Is there any way to get image from camera without UIImagePickerController?
I need to render current image(from camera) into image on my view and update it by timer.
May be AVCaptureStillImageOutput? I didn't find any examples.
Any ideas?
Yes, you can do it easily using AVCamCaptureManager and AVCamRecorder classes. Apple has a demo program build on its developer site here. It is named AVCam. In simple words what it does is when you click to open the camera, it calls the classes and methods which are responsible for opening the iPhone's camera and record video or capture audio. It calls the same classes which are called by UIImagePickerController.
I hope it helps.

Is there any standard fileopen dialog in iphone programming?

I want to create application, that will process images(mostly - photographs from mobile camera).
So i need at first to provide the way to open image file from phone memory.
how can i do that?
Sorry for such a stupid question, but i am newbie in iphone programming(yet:)).
P.S. I use xcode, cocoa
You can use UIImagePickerController to get a standard interface for selecting a photo from the user's library or camera roll. Depending on the configuration, it can also be used to capture a new image with the camera. Note however that you get a UIImage back, not a file, if you want to upload it somewhere, you will first have to create a file or NSData object from the image, using either UIImagePNGRepresentation() or UIImageJPEGRepresentation().

Iphone - Load image from camera roll to UIImageView without UIImagepicker

Is it possible to load the last photo from camera roll to UIImageView without using a UIImagepicker?
I mean retrieve the path to the file or something like that.
Thankz :D
You should be able to do this by using the new AVFoundation framework. You may want to take a look at the WWDC 2010 session videos discussing the framework and the related source code.

Is there a way to get paths of all the images of CAmera roll

Is there any way to create an array or something
having paths of all the images stored in camera roll.
Please enlighten me on this.
Thnx in advance
SpyPhone uses a direct path to the users photo library:
http://github.com/nst/spyphone/
It seems that any application can read it. However, this seems like falls under the area of "undocumented API" and could well be rejected in a real application.
I don't think there is. As far as the API is concerned for the UIImagePickerController you can only get a single path for a Movie that was recorded by the user (if running 3.0 on a 3GS). And even that path is a file URL to the temporary folder where the movie is stored before being written to the library.
You can't get paths for any images in the photo library or the camera roll.
When you pick an image using the UIImagePickerController the controller returns the Original Image and an "Edited Image" if the image was edited before being chosen.