vCards with photos for Mac OS X

The vCard support in Mac OS X is totally broken. Address Book generates invalid vCards and can not import valid vCards. Even when it can import a vCard, is usually can’t decode a Image which might be encoded in the vCard.

If you want to generate a vCard with a Photo which can be decoded by the Apple Tools you have to ruin a valid pice of vCard data like this:

card = string_with_a_valid_vcard
filename = "some-photo.jpeg"
if File.exist? filename then
  photodata = [].pack('m').to_s
  photodata = photodata.gsub(/[ n]/, '').scan(/.{1,76}/).join("n  ")
  card.sub!('END:VCARD', "PHOTO;BASE64:n  " + photodata + "nEND:VCARD")
return card


One comment on “vCards with photos for Mac OS X

  1. mdornseif
    2008-10-16 at 00:08 #

    more gnarf

    more gnarf
    You are not allowed to post to this mailing list, and your message has been automatically rejected. If you think that your messages are being rejected in error, contact the mailing list owner at

    From: Maximillian Dornseif
    Date: 2. September 2005 14:30:20 GMT+02:00
    Subject: Vpim & Adresssbook

    Did anybody so far manage to use Vpim to create a vCard including an image which will be imported by Apples Adress Book?

    Photos in vCards generated Apple’s Address Book look like this:


    Photos in vCards generated by vPim look like this:


    I think the Vpim output is correct. The problem is: it is not imported into Apples Address Book with an image and that is what I need. Did anybody succeed with that so far?

    This comment was originally posted on 20050905T07:48:46

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden / Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s