[Vobject] Embedding a photo into vcard

Markus Eberle markus.eberle at tngtech.com
Mon Dec 29 03:35:11 CST 2008


Hi,

I am trying to use python and vobject to create vcards which contain  
photos.
I can create a vcard which contains the base64 encoded photo but the  
Apple Addressbook won't recognize the photo.

Perhaps some one can give me a hint how to embedd a photo into a vcard.

Currently I am doing like:

             card.add('photo')
             card.photo.value = jpg
             card.photo.encoding_param = "b"
             card.photo.type_param = "JPEG"

where 'jpg' is

             i = Image.open(input)
             jpg = StringIO.StringIO()
             i.save(jpg, "JPEG")

(when writing 'jpg' to a file, it is recognized as a correct JPG-image)

Cheers,
     Markus


More information about the VObject mailing list