How to get names of Photos in PhotoLibrary in iPhone? - iphone

I need to get the information about photos like the path of the image, name and so on... in iPhone.
Is there a way to get this programmatically using SDKs done on non-jailbroken iPhone?

I'm afraid you can't programmatically on a non-jailbroken iPhone. I wouldn't know if you can on a jailbroken phone, but the non-jailbroken phone only lets you pick images with the UIImagePickerController class.
As you probably already know, the UIImagePickerControllerDelegate gives you an UIImage and optionally an NSDictionary with editing info (containing the crop rectangle and the original image). You don't know which image from the library it was (if it wasn't the camera itself).
Saving images is done with UIKit UIImageWriteToSavedPhotosAlbum method, which only lets you specify the image and a callback method when the image is written. After this method is finished (and the callback is done), you don't know where in the photos album the image is saved.
So unfortunately, the answer basically is: if you want information other than size, then no.

I'm interested in this subject too.
So far, I've been using the AV Foundation Framework (available since iOS 4.0) and got access to the pictures via ALAssets. You can get an image representation of the photo, the local URL to the pictures on the device or meta information about them (like the locations they were taken at for instance) but I can't find how to get the name and description of your pictures, as you can set them in iPhoto, as shown in the following screenshot (cf. red square : in my example, i'd like to get "MyPhotoName" and "MyDescription" strings).
So I think the partial answer to your question is: "use the AV Foundation Framework", and the other part is: "you can't access to some information related to your photos".
Can anybody confirm this is impossible to get the name and description information via the AV Foundation Framework?
Is there any other way to get it?

Related

Is it possible to change the album of a photo in the camera roll?

I would like to take a photo from the Camera Roll and assign it to a certain album. I don't want to delete the photo, I just want to change that little tiny attribute in which album it belongs.
According to the AlAsset Class Reference, photos are only editable if they were created by my own app. Does this mean that I can't change their album?
Would the only way to assign a photo to an album to make a duplicate of it, as suggested in this post? Is there anyway to not make a duplicate of a photo and just put it into an album?
If I put photos from my camera roll into albums or events with iPhoto on my Mac, they will disappear from the camera roll. Is there any way to do the same via the iOS SDK?
I hope i understand your question corectly, but I think the best way to do it would be to save the taken photo in a custom album. Martin tudorov has written a tutorial on this subject which I find very useful. It is designed for iOS 5 but I don't think there is much of change and you can tweak it for iOS 6 if you want. There is a sample project as well. Anyway here is the link to the tutorial which explAns it all and I hope it helps you solve your issue.
http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/
no,there is no way. But you can do it by using private API.

Is it possible to avoid the "use"/"retake" screen after taking a photo in an iOS app?

i have hired a programmer to create an iPhone app for me. The purpose of the app is to take a photo and upload it to a server. We want to make a special purpose screen to review the photo before uploading it. This specially developed screen will crucially have zooming functionality.
He claims that after taking a photo, it is impossible to avoid the "use"/"reuse" screen to show up, so now we have two screens to review the photo. First the standard one from Apple, then our own with zoom. Is he right about that? It just sounds so unreasonable that Apple would put such a restriction.
Edit: I mean taking a photo using the camera.
As par Apple's documentation
To perform fully-customized image or movie capture, instead use the AV
Foundation framework as described in “Media Capture and Access to
Camera” in AV Foundation Programming Guide. To create a
fully-customized image picker for browsing the photo library, use
classes from the Assets Library framework. For example, you could
create a custom image picker that displays larger thumbnail images,
that makes use of EXIF metadata including timestamp and location
information, or that integrates with other frameworks such as Map Kit.
For more information, see Assets Library Framework Reference. Media
browsing using the Assets Library framework is available starting in
iOS 4.0
In short yes it is possible check out this sample
[Update]
Use the allowsEditing property on your UIImagePickerController
imagePickerController.allowsEditing = NO;
Previous answer was a bit of a hack to take advantage of a code path that didn't show the buttons but wasn't awesome.
[Previous answer]
You can actually avoid it without going through the hassle of setting up your own image capture from AV Foundation.
Including the following will remove the need to show the "review" screen. All you have to do is put in a few of your own buttons and wire them up to the appropriate functionality.
[self.imagePickerController setShowsCameraControls:NO];
It is a little bit too late I know, but for future reference:
This is far more simple that the answers already provided,
what you are looking for is the allowsEditing option.
imagePickerController.allowsEditing = NO;
That should be enough to avoid showing the "Retake"/"Use" screen after the user takes a picture.

iPhone:Image API in iPhone

Is there any Image API available in iPhone?? so using that API I can develop a functionality to get all information of that photo in iPhone.
Thanks in advance.
You need to look at the ImageIO framework
http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/ImageIOGuide/imageio_intro/ikpg_intro.html#//apple_ref/doc/uid/TP40005462
yes, since IOS4 http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAsset_Class/Reference/Reference.html
depending on what you want exactly, this deals with the camera output.
The question is very fuzzy: please make it more exact.
if you want to get information about the size of the image, orientation, type etc, you can use the UIImage and CGImage classes which will give you information about the image itself. (size, colors, pixel size etc)..
If you want to get or access pictures in the Photos app of the iphONE, ALAssetsLibrary is what you need to read about - you can save and get images and videos from the iPhone's native album.
If you want the metadata saved alongside each image - like the location it picture was taken, the lens size, date taken etc.. - I am unsure how one gets that data.

iphone store image in application along with EXIF data

This is kind of continuation of this thread
iphone how to go to the image gallery after taking photo through Xcode
I am following the method suggested by Saurabh(the link given in the comment). I just want to know if the EXIF data will be retained if I follow this method(storing the image in the application)
The short answer, yes, it will be retained.

How to make UI Image Picker Controller read a custom source type in iPhone

I have to create a photo gallery app in iPhone. It should function same as the Photos app which is shipped with iPhone. But it should show the images which I package with the app.
UIImagePickerController reads only the following source types.
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
I was thinking of adding the images bundle to the resources group in Xcode and make UIImagePickerController to read them and display.
Looking at the class references I found UIImagePickerController reads only from the resources mentioned above. Which means it can only pick the images from camera roll OR saved photo gallery OR allow user to take a pic and use it.
Does anybody know how to make UIImagePickerController read from custom source type or images?
OR
How to create a photo gallery app in iPhone :-)
Thanks,
AJ
I don't believe it is possible to make the UIImagePicker pick images from your own source. You will have to write the picker yourself (which, performance aside, doesn't seem to hard... Just a couple of UIImageViews in a UIScrollView).
Just today I started a open source UIImagePickerController clone, it is not perfect but it works quite ok. Feel free to fork http://github.com/jeena/JPImagePickerController