The Painter Goblin: Part 4, Putting it all together…
Following the previous posts, bringing this all together meant three different applications.
- Paintergoblin.py – creates the images, can be run standalone
- Wikigoblin.py – retrieves data to tweet from the Wikidata SPARQL services
- Twittergoblin.py – Tweets for us! Either a random Wikidata image or from am existing Wikidata link
We create Tweetable information using the wikigoblin. We perform the Tweet using twittergoblin. In between the paintergoblin has to create his art!
We’ve seen examples of the images from the original zine.
I had a few different attempts trying to recreate these effects automatically using Python’s image library. Pillow https://python-pillow.org/
I knew this would give me much of the processing capability that was needed, I just didn’t know how close I could get to the effect which had originally been created manually.
The experimentation was fun. I couldn’t get as close as the zine, but in the end it helped me select the following algorithm for creating images:
- Enhance brightness and contrast (Some old images are faded and so this helps to pull detail out of them)
- Enhance saturation (This makes the colours more vibrant)
- Convert to an indexed image of five colours (This then restricts the number of colours to the most common found in the image)
- Swap in a new, randomised, palette from a list of palettes
Et voila! The piece is done!
Palettes
Good spot. I haven’t really spoken about these. Palettes have been of interest to me for a few years, see http://exponentialdecay.pythonanywhere.com
The effect on even a small image given the right palette is, well, I can’t qualify it. It’s just nice.
And so I wanted to try and achieve the same with Painter Goblin.
So far I have created a number of palettes. Some have been inspired from previous ones, others from computer games, or teletext, or just how I feel. The French flag palette turned out well. As the code lives longer and folk become engaged with it, myself included, I’ll add more palettes to see how they work. Not all will last, and some will be modified over time – I’ve already darkened some of the reds in the more extreme red palettes. It’s just about finding a balance.
I like how mood and atmosphere changes given certain palettes. I like how meaning seems to change. And I like how patterns appear.
Some work the Goblin has already done…
(Wikidata: https://www.wikidata.org/wiki/Q3535485)
(Wikidata: https://www.wikidata.org/wiki/Q29626086)
(Wikidata: https://www.wikidata.org/wiki/Q17334682)
Though the effect is not exactly the same, when we look at the original zine. It is still something I think is true to the spirit. I do think an algorithm is possible where false colour is used effectively on regions of an image with just the brightest or most prominent colour, but then I became charmed by how brash some of these palettes made existing paintings and other mediums. Through experimentation and play, these images became the Painter Goblin’s.
The Goblin and Me…
One thing we will always have Is art. Of course, the Painter Goblin’s is not his own – it’s borrowed – years old – public domain material. This work has helped me engage with that and learn more about artists, and their work – I’ll learn more as I engage more. I’ve already added different styles to the algorithm as well, differentiating between watercolours, prints, posters. Some styles haven’t worked, like drawing where almost too much detail exists. I enjoy working with the palettes. I love the surprise of a new image in the morning should the Goblin Tweet automatically overnight.
Some nights, I can just sit, looking for other pieces of art on Wikidata and see where the algorithm takes it – trialling different palettes, and just choosing where and when to Tweet outside of the Goblin’s scheduled times.
I like how the work reveals new detail about images and artificially highlights parts of an image that may not have been prominent before. Because we treat all images as ‘indexed’, we can even swap out grey-scale palettes for colour ones making grey-scale images all of a sudden colour. I like that idea,
(Wikidata: https://www.wikidata.org/wiki/Q45585)
It’s like we’re both creating art, and right now, it’s nice to have the Goblin around. I hope you get something out of it too.
1 thought on “The Painter Goblin: Part 4, Putting it all together…”