Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the cropping frame of the address book image data?

The AddressBook framework provides ABPersonCopyImageData for getting the contact image for each address book entry. This is great for the image data, but the user also sizes and crops the image for framing purposes. When I get the image data, I get the full image, and not the cropped image. How do I get the frame the user used to crop the image (or in lieu of that, how do I get access to the cropped image/data)?

like image 748
Douglas Mayle Avatar asked Jul 10 '10 17:07

Douglas Mayle


1 Answers

iOS 4.1 adds a new method: ABPersonCopyImageDataWithFormat in ABPerson.

I'm using it like this:

NSData *imageData = [(NSData *)ABPersonCopyImageDataWithFormat(recordRef, kABPersonImageFormatThumbnail) autorelease];

The formats allowed are:

kABPersonImageFormatThumbnail
kABPersonImageFormatOriginalSize

This allows you to get the original image or the cropped image (thumbnail).

like image 187
Sceeter Avatar answered Jan 01 '23 21:01

Sceeter