Last night, I was looking for a background image that would visualize the main theme of this blog to make it more appealing. Since we chose “Bits and Bases” as the tag line for the blog, an image showing random sequences of bits interspersed with random sequences of nucleotid bases seemed perfectly adequate. Not unexpectedly, a web search for suitable images did not turn up any useful hits, so I started to look for a programmatic way to create the desired symbol strings, preferably in my favorite language, Python.

There are at least a dozen different packages that would allow you to do this comfortably in Python, but I ended up with a slightly unusual choice: NodeBox, an application that allows you to create stunning 2D visuals with very little effort. What was particularly captivating about NodeBox was not only the beauty of the samples shown in the gallery, but the ease with which it allows you to explore its features interactively: Just copy&paste some of the sample code in the script editor panel, press F5 and review your rendered artwork on the display panel (or, if your script contains an error, decipher the strack trace in the message panel).

The script shown below runs inside the NodeBox environment which already has all the relevant drawing functions in the global namespace:

Pretty simple – but it is astonishing how different the results look with different symbol and background colors or with different font sizes.

Obviously, the script above only scratches the surface of what NodeBox can do. There is much more to explore within NodeBox (paths, transformations, images) and beyond (e.g., the fancy NodeBox 2 project which adds a graphical workflow layer on top of the NodeBox engine). Enjoy!