wanting to process v-card data
I have v-card files (VCF) that have contact pictures encoded in them. The spec says that these are "base64" encoded if they are not a URL to the photo file. The original photo files are who knows where.
Can someone tell me how to take these photo-blocks and decode them into images? Does anyone know of a linux-based contact manager or address book that can do all or part of this Processing summary:
Thanks in advance, ~~~ 0;-Dan |
do the usual suspects handle your vcf format (thunderbird, evolution, ...) ?
else you may need to do something custom with dd or write a c-program to grab the bytes you want. the rest of the stuff seems script-able; whats does "normalized" (#4) mean ? |
I'd definitely use Perl for that using eg http://search.cpan.org/~llap/Text-vC...Addressbook.pm, although I'd also ask over at perlmonks.org (its where the Perl gurus hang out), in case there are even better/easier modules/techniques available.
Perl has the module http://search.cpan.org/~capttofu/DBD...b/DBD/mysql.pm for MySQL, for which you'll also need the DBI module. If you have installed MySQL, you may already have those available. You should be able to get them from your repo, not CPAN direct. |
i havent used any of these programs but they may be of interest to you:
Code:
[schneidz@hyper ide-34]$ yum search vcard good luck. |
Quote:
Thanks, ~~~ 0;-Dan |
Quote:
My troublees start once I have the base64 block stripped to a file. What do I do next? Is it simply 'uudecode' of the block? Which photo format do I get for the decode results? If it restores the original format, how do I know what that was? (laugh) That's why this is called a project. Thanks, ~~~ 0;-Dan |
Somewhere out there is package land there must be an address book or contact list that will read most of the popular vCard file formats...
Grrr Arrgghh, ~~~ 8d;-< Dan |
Wikipedia offerss the following explanation of Base64 http://en.wikipedia.org/wiki/Base64
Quote:
|
It appears that regardless of which image format (jpg, png, etc) one supplies as the contact photo, its bits get encoded and stored and written into the corresponding vCard file.
When you decode the vCard file, how do you know which image format to use when storing the results? ~~~ 0;-Dan |
Not sure if this is of help
man base64; that should get you going with the decoding part To determine what kind of file it is, you can use the file command With some bash scripting, you should be good to go. I did not research it, but I'm quite sure that you can find a library for the programming language of your choice to do the base64 decoding. The same might apply for functionalities provided by 'file'. |
Quote:
A vCard has a photo blob (binary large object) encoded as Base64. Process the vCard file and extract the blob characters, then decode them from Base64. Now you have a blob that is binary. Write the binary to disk separated from the vCard file. At this point we have someName.vcf and namePhoto.dat. (I call it a DAT file, because I do not know which photo image format was supplied during the original encoding process.) Is there some vCard item that tells me that the photo is JPG vs. PNG vs. GIF vs. ??? Alternately, am I face with reading the DAT file bits looking for a file format signature and then guessing at the source format supplied to the original encoding? Are you telling me that 'file' will read and interpret those DAT file bits? Hoping I'm clear this time. ~~~ 0;-/ Dan |
Quote:
Code:
wim@aa0:~/images$ cp IMGP8955.JPG IMGP8955.txt |
Quote:
regrads, schneidz |
Quote:
Code:
BEGIN:VCARD and stores it. When you save that contact as a vCard, the encoded image data gets written into the PHOTO attribute. I can decode the PHOTO attribute back to its original binary. However, I have yet to discover how to programmatically learn with photo image format to declare when I name the saved binary after the decode. ~~~ 0;-Dan |
Quote:
also, is that your real address ? |
All times are GMT -5. The time now is 12:53 AM. |