“Happy Holidays”, the Wolfram Language Way
I have the good fortune of knowing many people, which means I end up sending out lots of holiday cards. For many years I used to send out physical cards. But last year, convenience, timeliness and ease of reply made me finally make the switch to e-cards.
I often like to write notes on the cards I send. And when I was sending out paper cards, that was straightforward to do. But what about with e-cards?
Well, it’d be easy to type messages and have them printed on the e-cards. But that seems awfully impersonal. And anyway, I rather like having at least one time each year when I do a bunch of actual writing by hand—not least so my handwriting doesn’t atrophy completely.
So there’s an obvious solution: handwritten e-cards. Which is exactly what I did this year:
The background image was created by our (frequently award-winning!) company art department. (This year, the white “Spikey” is 25-pointed, celebrating the 25th anniversary of Mathematica.) But how did we get the handwriting onto it?
With the Wolfram Language, it was really easy.
First, I got together the list of email addresses I wanted to send e-cards to. Then we had code to print out pieces of paper like this:
Then I actually did my Christmas thing, and went through and wrote all the messages I wanted to write:
Then we took this stack of pages, and ran them through a scanner, getting a bunch of image files. And now we can go to work.
First, import the file:
Then pick out the part of the image corresponding to the handwritten message (the numbers are an approximation found using an interactive tool):
Now we image-process the message, and make it the right size:
Here are the elements of the actual card we’re trying to assemble:
Now we create a version of the card with the right amount of “internal padding” to have space to insert the particular message:
And then we’re ready to use ImageCompose to assemble the final image:
OK, so that’s the card we want to send. Now, who do we want to send it to? To get that, we just have to use TextRecognize to do OCR on the original scan:
And finally, just use SendMail to send the card to the address we’ve got.
And that’s it. Handwritten e-cards. Of course, since I have a lot of techie friends, there were quite a few responses along the lines of, “How did you do that?”
Well, now it’s not “my secret” any more. And by next holiday season, the Wolfram Cloud will let one make this a service anyone can use. And maybe I’ll have to come up with another little innovation for my own cards…