Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get image of a person from iPhone address book

How do you get a person's image from an iPhone address book?

like image 269
Madhup Singh Yadav Avatar asked Jan 18 '10 12:01

Madhup Singh Yadav


People also ask

How can you see someones Contacts picture on iPhone?

To get photos into contact, open Contacts, go to the contact and click Edit, then add a photo. Is this Messages in iOS or osX? Go to Settings>Messages>Show Contact Photos.

How do I identify faces in iphoto?

In the Information pane, click Faces to open the Faces section. In the photo, an “unnamed” label appears under detected faces. If the face you want has been detected, click the label and type a name. If no label appears, the face hasn't been detected.

How do I get contact pictures on my Contacts?

Open the Contacts app and select the contact. In the contact's information, tap on Edit from the top-right corner. Tap on Add Photo or Edit Photo. Select the Camera icon to click a picture or All Photos for an image from the library.

How do I download a contact photo?

Instead, open Google Contacts, select the person, select the profile images in the circle to open it up full screen, and then take a screen shot to save to device. Typically on Android, you simultaneously hold down the power button and the volume down key to take a screen shot.


2 Answers

You can do it like this....

NSData  *imgData = (NSData *)ABPersonCopyImageData(person);

UIImage  *img = [UIImage imageWithData:imgData];

where person is of type ABRecordRef. Now, as CFData and NSData are toll-free bridged, you can simply type cast CFData to NSData and get the image

Hope this helps.

like image 170
Madhup Singh Yadav Avatar answered Oct 20 '22 00:10

Madhup Singh Yadav


(NSData*)ABPersonCopyImageDataWithFormat([targetPeople objectAtIndex:index], kABPersonImageFormatThumbnail)

This is faster since it returns a thumbnail.

like image 23
ChangUZ Avatar answered Oct 19 '22 22:10

ChangUZ