Illustration

Handwriting to Vector: Turning a Handwritten Recipe into an SVG

5 min read

Handwriting becomes a vector once you scan or photograph it and run that through Vectorgram as an SVG, with Image type set to Drawing. Every word comes back as black filled shapes on white, which stay sharp at whatever size the writing is printed or burned.

A handwritten recipe in pencil and pen on yellowed card, the same writing traced as fine outlines, and the SVG with every word in black on white

Our example is a recipe somebody wrote across the cover of a menu from Childs, the restaurant chain: a quart of mashed wheat, a gallon of warm water, four pounds of sugar, two raw potatoes (crossed out), a yeast cake, and let stand three weeks. A home brew, in other words. Half the lines are pencil and half are pen, on card that has gone yellow. We wanted it burned into a wooden board about 20 cm across, which is what a lot of people end up doing with a recipe in a grandparent's hand.

Two inks on yellow card

Image type starts on Regular image, and with that the SVG copies the card as it looks. The card turns into one flat cream rectangle, its grain and stains gone, the pencil comes back a light greyish brown and the pen a dark grey. 100 shapes, 67 KB. For a print of the card as it is, a framed kitchen print or a tea towel, that file is enough.

Switch Image type to Drawing (every paid plan has the switch) and the card returns as black on white and nothing else: 84 shapes in two colours, 64 KB. We expected pencil and pen to end up looking the same, but the pencil words, black now, have lines about half as thick as the pen's, so the two still read as two weights of line. One thing went missing on the way: the full stop after qt.

Straight from the converter. Regular image has the cream card and both inks; Drawing turns both black, the pencil in thinner lines.

Where the pencil went missing

The common way to get black and white out of a scan is a threshold: pixels darker than one grey turn black, and the rest turn white. potrace works by such a threshold, and Inkscape's Trace Bitmap behaves the same way in its Brightness cutoff mode. On our card the pencil sits at about 150 on a scale where black is 0 and the card is 233, so it is lighter than the usual cut-off at the middle, 128.

We ran potrace at 128. It kept the pen and very little else. Of mashed wheat it left the t, and 2 raw potatoes went entirely. Moving the cut-off up to 200 brought the pencil back in broken pieces, with potatoes still in bits, while the pen words grew heavier. Drawing kept every pencil word as a line.

The first five lines up close. The pencil is lighter than potrace's middle cut-off, so mashed wheat and 2 raw potatoes are lost, while Drawing has them as lines.

A black blob under the sugar

A laser burns whatever is in the file, so the card had to go before the board. In the Drawing file the card is a white rectangle lying behind everything else. We deleted it and laid what was left on a wood tone to see what the laser would get. The writing was all there, and so were 52 white shapes, one inside every closed loop of the writing: in the a's and o's, in the tall loops of h, l and d. On the board each of them would come out as a spot of its own.

Selecting all the white and deleting it was worse. Under the white, the ink in this file is solid; it was the white shapes lying over it that kept the loops open. With them gone every loop filled in, and the capital P of potatoes, which swings right under the tail of the g in sugar, became a black blob the size of two letters.

So we ran the card again and switched Geometry, another of the conversion settings, to Flat. This mode punches every loop out of the black, and once the white is deleted the wood shows through the holes and only the writing is left. It comes to 62 KB, and it is the file we would give the laser software.

Getting the ink alone. Deleting the card leaves white in the loops; deleting all white fills them, worst at the P under sugar; the Flat file loses its white and keeps the loops open.

While selecting, we also thought of leaving the crossed-out potatoes off the board. That cannot be done with a click. On the card the word, its strike line and sugar touch each other, and in the file they are one shape; yeast and stand are another such pair. Taking the word out means cutting it away by hand in the editor. We kept it: the crossing out is part of the person who wrote the card. Two specks of card at the bottom right were shapes of their own, and those we did delete.

Twenty centimetres of board

Opened in Inkscape, the card measured about 34 cm across, because the file states its size in points. With the proportions locked, we typed 20 cm into the width. At that size the pen lines are 0.8 to 1 mm wide and the pencil lines about 0.4 mm. On a 10 cm coaster the pencil would be 0.2 mm, so on a small piece the pencil words are the ones to look at before the wood.

Your own handwriting

The card is 0.8 megapixels, well inside the limit for Drawing, which is around 2.5. Above that, an upload is converted the Regular image way whatever the setting says, so cut a phone photo of a whole page down to the recipe or the signature first. A scan or a photo can weigh up to 50 MB, saved as PNG, JPEG, WebP or BMP.

If you want to see your own page converted first, the vectorgram.ai home page has a demo for that, without signing up; it answers with an image you can look at, not a file. Files need a subscription starting at Lite, and every plan you pay for has Image type and Geometry. A converted card is kept for a day by default, in your workspace and dashboard, and the storage time can be set longer.

Most of the editing on a handwritten page goes into places where the ink touches: words that run into each other and crossings-out arrive as one shape, and whether they stay is your call.

Related guides