@Philateleology

A generative-art Twitterbot • September 15 2022

I launched @Philateleology on Twitter in October of 2019, but I recently relaunched it (it was broken for the better part of a year) so I thought I’d document how it all came together.

If you follow Present & Correct on Twitter (and if you love the idea of perfect little office sundries, what are you waiting for, go now), and specifically if you followed them on Valentine’s Day of 2019, you would have seen this image:

I was already thinking about how I might approach building a image-based bot on Twitter (having created some text-only bots previously), and something about this unlocked a deep creativity module in my brain – the limited and lovely palette, the geometric design, and most importantly, my perception of a flavour that could be replicated in a generative format. Also, obviously, the format: stamps!

I abstracted out the parts of this that I found the most charming – the colours, for example. If you check out @philateleology, you’ll find a lot of similar tones are in there. I wanted to evoke this (mid-century-ish?) feeling without necessarily referencing anything specific. Hot tip: sampling a palette from something that already exists is a great seed crystal for new projects!

How does it work?

I’m not a developer and I would never claim to be one. I know just enough about gluing code nubbins together to be relatively confident that I could make something that fulfilled the vision I had for this project. But: before I ever put any kind of code together, I considered the end result I wanted (and mocked it up super quickly). Having a concrete reference for the end goal helped me break down the steps I’d need to take to make it happen.

After a few steps of visualization and some very roughly coded proofs of concept, I settled on a tile-based approach – that is, the bot would pull from a set of precomposed tiles, not generate the art wholesale. I built a set of repeatable patterns and created variations using the palette I’d settle on. Those tiles look like this:

A bunch of tiles. Note that there’s some that never appear in the end result because I thought they looked weird – that’s just the artistic process, baby!

There were more assets that I needed to create (like the stamp frame itself), and I also included a text layer using the delightful Biorhyme by Aoife Mooney. All of this is composited together using a library called PHPImageWorkshop. I use PHP because it’s singularly useful (for me!) for bashing stuff together: it runs everywhere and is extremely well-documented, by which I mean copying and pasting from Stack Overflow almost always works. PHPImageWorkshop feels a little like a command-line Photoshop (e.g., composition of a final image in layers) so it was a good toolkit to use here too, as it fit my mental model of how I might construct this if I were doing it all manually.

The final steps were to actually get output from PHPImageworkshop and shuffle it over to Twitter. As of this writing, everything lives on AWS Lightsail, which is a cheap and cheerful place to dump assets that also handily executes PHP. The final piece of the puzzle is Make (formerly Integromat) which hits a specific URL on Lightsail on a fixed schedule, grabs the compiled image in question, and performs some sorcery on Twitter’s API to actually post it. Ta-da!

This was a hugely valuable (and fun) learning experience, in terms of having an idea and carrying it all the way through to a real, tangible output. If I’ve done the math correctly, there’s something on the order of 366 trillion possible combinations of the tiles – which means I am constantly delighted by what the bot creates. It’s fun to build a system and then just step back to see what it does.

Bonus content: the bot name Philateleology comes from philately, “the collection and study of postage stamps”, and teleology, which has several meanings, the most salient of which is “the study of evidences of design in nature”.