Export VCF image to JPEG

pentzzsolt picture pentzzsolt · Mar 10, 2013 · Viewed 15.1k times · Source

I have created a .vcf contact with an iPhone and sent the file to myself in email. In that .vcf, I took a photo which is directly saved in the vCard, not in the phone's memory.

In the source of the .vcf, there is a code part starting like this:

PHOTO;ENCODING=b;TYPE=JPEG:/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAA

And it continues on... Now, I would like to get this photo and save it as a .JPEG. Any ideas how to do that?

Thanks.

Answer

benc picture benc · Aug 21, 2016

In macOS, it easy to to from the line command with "vi" and "base64.

For example,

Export the "Apple Inc." contact that comes with every user account.

  1. Use vi to manually remove the other lines.
  2. Remove the heading and the meta-data for that line

PHOTO;ENCODING=b;TYPE=JPEG:

  1. base64 decode the remaining file

# base64 -D -i Apple\ Inc..vcf -o Apple_Logo.jpeg