iOS Contact Image not cropped
scriptPilot opened this issue · comments
Describe the bug
When adding a contact photo via iOS Contacts and crop the face from a large image, the large image is retrieved not only the cropped face as expected.
To Reproduce
Steps to reproduce the behavior:
- Create a new contact in iOS Contacts
- Choose a lager image
- Crop a face
- Save
- Retrieve contact with this API
Expected behavior
Cropped image / face retrieved as base64 string.
Screenshots
n/a
Smartphone (please complete the following information):
- Device: iPhone 11 Pro, iOS 16 - other iOS devices same behavior
Additional context
- No problem with photos synchronized from Google Contacts
The CNContactStore
in Swift provides the following two image types:
CNContactImageDataKey
and CNContactThumbnailImageDataKey
.
Currently it's returning the value belonging to the CNContactImageDataKey
. I'm not sure if the CNContactThumbnailImageDataKey
would return a 'cropped' variant. It would return a thumbnail though. So I'm not sure if that is desirable. What do you think?
If you have access to Xcode, you could easily test the difference between to two by the way. Just navigate to the source code and swap:
- the occurences of
CNContactImageDataKey
withCNContactThumbnailImageDataKey
contact.imageData
withcontact.thumbnailImageData
@tafelnl - Thanks a lot for that proposal. I've just tested it and the images are still returned full, not cropped, but in poorer quality. So this proposal does not solve the initial problem unfortunately.
In that case I am afraid it's not possibly to do what you want. Because Apple does not offer any other thing in their CNContact
API that I know of
Ok - thanks for looking into it.
No worries