Insecta Bot

Published: 14th April, 2019

In the summer before my A Levels (2016) I created a twitter bot that made and posted art, specifically insects.

I had just been to EMF camp and was inspired by the projects that people had created and decided to make the idea I had been sitting on into a reality.

A screenshot of a template file in Photoshop

The bot uses Photoshop scripting to randomly generate insects based on the templates I designed. I currently have three butterfly templates, a ladybird template and a dragonfly template. The templates have a series of different layers, which the script chooses to hide or show. The documentation for Photoshop scripting is available here.

Each template has a few styles to choose from, and effects to overlay. All of the colours are randomly chosen (sometimes from a specified colour range such as for the ladybird shell). The script can also choose to use gradients of different colours in some cases.

Once the script has chosen all of these factors, the layers are combined and a small amount of noise is added to the result just to finish it off nicely.

A generated butterfly

Once I had achieved this I decided I wanted the bot to be able to take requests from Twitter users. This portion of the program used node.js with twit to fetch the requests. I then altered the original Photoshop script to use the information I extracted from the tweet to limit the generation to their request. Users could specify the insect, the colours used and/or the background pattern.

The requests in their current form probably won’t be running again as a computer that runs it needs to be able to use Photoshop, and it can’t just sit in the background on my PC all the time so it’s just impractical. I am running the regular posting again however as the insects can be pre-generated and so I don’t need to always run my computer to upkeep it.

As I started this project about 3 years before writing this post, there is certainly a lot I would change if I were to do this project now. It was my first proper programming project so a fair amount is messy or hacked together. However, it was such a valuable experience and led me to want to work on more projects and really confirmed to me that I wanted to do more programming.

(For those curious the code is available on my GitHub)