2

I am trying to export contact photos for my iCloud Contacts. I initially tried exporting my contacts as a vCard, but iCloud doesn't include profile pictures when exporting. (Interestingly, iCloud Contacts can import photos from a vCard)

Manually saving the photos from the iCloud Web app didn't work either, as the Save Image as option was missing when right clicking my contact photos.

Is there any way to export my contact photos from iCloud?

1

When exporting vCard from iCloud Web app, the image data is not included in the card. Contact profile picture in such cases can be extracted using the included Web Developer Tools in your Web browser. The procedure is almost similar for all modern Web browsers, I'll use Safari as an example here.

Developer Tools are not enabled by default in Safari. To enable them open Safari preferences by going to Menu bar → Safari → Preferences.. or use the keyboard shortcut Command + ,. Now go to Advanced tab and check Show Develop menu in menu bar.

enter image description here

Now open Contacts section in iCloud Web app and select the desired contact. Once you have selected the contact, right click on the profile picture and select Inspect Element from the context menu. This is generally the last item in the menu.

enter image description here

Clicking on the Inspect Element item will open the Web Inspector, a tool generally used for Web design and development.

enter image description here

As you can see, the Web inspector has opened with a node pre-selected (basically an HTML image tag) corresponding to the profile picture selected. Within the tag, you'll be able to see an item similar to:

href="https://p12-contacts.icloud.com:..."

which is a hyperlink. Simply click on the link. It will display the original image assigned to the contact under the Resources tab in Web Inspector.

enter image description here

Voila! you have the contact profile picture. Simply drag the image to Finder to save it.

  • Can this be automated to at least the point where it saves the image name with the contact name ? See my comment below too – ankiiiiiii May 31 at 3:25
0

If you have a Mac sync you iCloud and go to

~/Library/Application Support/AddressBook/Sources/xxxxxxx-xxxx-xxxx-.../Images
  • Okay I got the images. If not all, some. Some from fb profile photos too. But how do you map the image to the contact card ? – ankiiiiiii May 31 at 3:23
  • Where do you want them transferred to? When people went from mac to windows, I used to login to a google account and make a transfer via the contacts app in mac on google and then export with google. – The33Coder May 31 at 9:27
  • In the card file, so that say another Mac or for simplicity, a database can have it all. The contact with its photo. – ankiiiiiii May 31 at 14:33
0

There's a manual approach you can use to export contact image. Export the vCard normally as a .vcf file.

Now the vCard file contains the profile picture data encoded in base 64 format. Open the .vcf file in a ASCII text editor. Remove all the fields except the one starting with:

PHOTO;ENCODING=b;TYPE=JPEG:

Now, also remove the above string. You'll be left with just the base64 encoded string. Save this trimmed file. Now open Terminal and run the following command:

base64 -D -i contact.vcf -o Contact.jpeg

Here, contact.vcf is the trimmed contact card file and Contact.jpeg is the name for the desired image file.


Here's a sample vCard to illustrate the example. I have trimmed the sensitive contact information and truncated the base64 encoded image data to cut it short. Here's the original vCard data as seen in an ASCII text editor:

BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iOS 12.2//EN
N:Neema;Nimesh;;;
FN:Nimesh Neema
NICKNAME:Monu
EMAIL;type=INTERNET;type=HOME;type=pref:xxxxxxxxxxx@gmail.com
EMAIL;type=INTERNET;type=HOME:xxxxxxxxxxx@icloud.com
TEL;type=CELL;type=VOICE;type=pref:+91 99999 99999
TEL;type=CELL;type=VOICE:+919999999999
TEL;type=CELL;type=VOICE:+91 99999 99999
item1.ADR;type=HOME;type=pref:;;xxx\, xxxxxxxx xxxxxxxxx\, 99/9\, xxxxxxxx;
 xxxxxx;xxxxxx xxxxxxx;000000;India
item2.URL;type=pref:http://xxxxxxxxxxx.com/
item2.X-ABLabel:_$!<HomePage>!$_
BDAY;value=date:1986-08-20
item3.IMPP;X-SERVICE-TYPE=Skype;type=pref:skype:xxxxxx.xxxxx
item3.X-ABLabel:Skype
PHOTO;ENCODING=b;TYPE=JPEG:TU0AKgAHNwSus8mus8mus8mssceus8mvtMqus8mtssisscetssivtMqts8
 mvtcuvtcuvtcuwtsyxt82yuM6xt82xt82xt82wtsywtsywtsywtsywtsyxt82vtMqxtsywtsyv
 ...
X-ABUID:A73CE32D-5308-4DBB-BAA0-DB16C1EBE31A
END:VCARD

After removing all the lines except the image data, the truncated image content looks like this:

PHOTO;ENCODING=b;TYPE=JPEG:TU0AKgAHNwSus8mus8mus8mssceus8mvtMqus8mtssisscetssivtMqts8
 mvtcuvtcuvtcuwtsyxt82yuM6xt82xt82xt82wtsywtsywtsywtsywtsyxt82vtMqxtsywtsyv
 ...

After removing the header, the final base64 string (truncated) looks like this:

TU0AKgAHNwSus8mus8mus8mssceus8mvtMqus8mtssisscetssivtMqts8
 mvtcuvtcuvtcuwtsyxt82yuM6xt82xt82xt82wtsywtsywtsywtsywtsyxt82vtMqxtsywtsyv
 ...

which needs to be saved and fed to the base64 command.

  • When I export from icloud.com, profile photos are not included in the vCard file. – Stevoisiak May 30 at 18:54
  • @StevenM.Vascellaro I have added a different answer to cover that use-case. – Nimesh Neema May 30 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .