Vector Images from Text Files

It is possible to generate images from texts by converting each character into a vector (a line). This procedure works with shorter texts, such as poems and song lyrics. I wrote a program for this purpose, called txt2vectors. The program reads a plain text file, opens a 640×480 white window and draws black intersecting lines corresponding to the ASCII values of the characters composing the text. Once you have your image, you can have fun trying to spot recognizable shapes in the seemingly random grid pattern that will form. You can save the image by grabbing a screenshot with a tool such as the Snip & Sketch tool included with Microsoft Windows.


Download

Click the button below to download the Windows executable and the Python source from GitHub.


An example of output

The image below was obtained processing through the program the text included in the ZIP package.

William Shakespeare – “To be or not to be” monologue from “Hamlet”