Missing AddressBook API to deal with thumbnail VS full-size contact pics

Originator:mabene
Number:rdar://8869784 Date Originated:Jan 15, 2011
Status:Open Resolved:
Product:iOS SDK Product Version:4.x
Classification:enhancement request Reproducible:not applicable
 
Dear Apple team,

this note is to request an addition to the AddressBook API of iOS 4.x.
The AddressBook framework has been recently extended with a new function:

CFDataRef ABPersonCopyImageDataWithFormat (ABRecordRef person, ABPersonImageFormat format);

whereby one can retrieve separately: (1) the squared contact thumbnail picture with format=kABPersonImageFormatThumbnail AND (2) the original full size picture the thumbnail comes from, with format=kABPersonImageFormatOriginalSize.

While it is quite useful to have separate access to these two images, there are two missing functionalities in the current version of the API that makes the mechanism incomplete and asymmeric:

A) It is possible to READ the two different images, but it is not possible to WRITE them separately (programmatically) into the address book. The only available API is ABPersonSetImageData(…), which seems to set both images to the same value.

B) It is not possible to know which is the crop rect that was applied to the original image to obtain the thumbnail.

These two features would be useful, for example, to support the following use-cases:

A) the user assigns a pic to a contact from a third party application using some custom controller (not the system AddressBookUI), selecting some portion of a larger image; the information about such larger image is lost (or saved to the image library but without any reference to the contact), so it won't be possible for the user to adjust the image later

B) the user needs to adjust (scale/move) a contact thumbnail that she knows has been cropped from a larger image. This functionality can't be provided outside AddressBookUI because the crop rect of the thumbnail is unknown. Image processing techniques (template matching) could be used in principle to locate the thumbnail within the large image, but this is a heavy workaround to obtain (an approximation of) a simple piece of information which is possibly already stored somewhere privately in the AB database.

To fix these problems, it would be sufficient to:

A) include a new function:

bool ABPersonSetImageDataWithThumbnail (ABRecordRef person, CFDataRef oriImageData, CGRect cropRect, CFErrorRef *error);

where all the arguments are like in the existing "ABPersonSetImageData", but what is passed as input (oriImageData) is the original full size image; the thumbnail image will be implicitly assigned cropping the portion identified by "cropRect". So basically this function assigns both the thumbnail and the full size image, specifying only the latter, and giving the crop rect of the former

B) include a new function:

bool ABPersonGetImageCropRect(ABRecordRef person, CGRect *cropRect)

which returns TRUE iff the record for "person" actually has two different images (thumbnail and full size), returning in cropRect the crop rect of the thumbnail in the large image.

Thank you for considering this extension.

Pierangelo

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!