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 an
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).
To some extent, it's a bug in iOS4. Previously, the address book API returned cropped data, and in iOS4 it returns the whole image data. Some people want one, some people want the other. I tend to think the whole image data is useless without the cropping frame, so hopefully that will get fixed...
I think it's impossible to get the crop rect. The crop rect information is stored inside the sqlite database that managed by addressbook framework. But client's application cannot read another application's sqlite database, according to the sandbox structure.