capacitor-community / contacts

Contacts Plugin for Capacitor

Home Page:https://capacitor-community.github.io/contacts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. Create a new contact in iOS Contacts
  2. Choose a lager image
  3. Crop a face
  4. Save
  5. 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
commented

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:

@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.

commented

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.

commented

No worries