In the last post I alluded to the fact that what I was creating for Artomatic was going to be a little bit more holistic and effect focused than in the recent past. This year, I’d like to get into blending media, rather than focusing on it.

I’m still mulling over what I want to say about the whole thing, but tonight I’d like to offer a prelude by way of a small technical glimpse into the core of the piece.

Essentially, I’ve been wanting to work on the idea of self for some time. The Second Life work had addressed some of that, but -primarily- from a perspective that was fairly extreme and lacked a lot of emotional resonance (not least with me).

So this year, I’m going to be mixing up my newfound interest in photography with some traditional sketching technique, adding a dash of emotional investment, and finally tying it together with some custom computer scripting.

It’s this last component I want to talk about. There are a lot of “themes” Im starting to address with this piece (later post) which made me feel like I needed to use some sort of mosaic. Initially, I thought I was going to do a self-portrait of myself….composed the very same self portrait. This would constitute the anchor concept of the piece.

The image was originally supposed to look something like this (right image is zoomed in on the left eye where you can see the main image is composed of many copies of itself)

But how does one go about creating this kind of mosaic? Doing it by hand would take so long I’d never finish!!!

Maybe there are programs “on the internet” that will do it? Maybe (it turns out there -sortof- are), but what’s the fun in that?

Instead, I decided to write my own program to do it. This has a lot to do with the fact that computers are a huge part of who I am and writing code to help me generate a self-portrait struck a chord with me

I had played around with the Python scripting language back in my NetSec days (for rapidly setting up data analysis) and while I had never been particularly proficient in Python and it had been some years since I’d worked with it, I -had- enjoyed it’s way of dealing with the world of bits and bytes. it seemed like a great language to try this out in.

So, I grabbed my new Macbook (heh. Microsoft forced me into -that- with Vista) – which had python already on it – and sat down to write a self-referential mosaic generator. Away we go!
Hrm. Or not. How does one actually go about editing images with a scripting language often used in web pages? It beat me! I’d never done it before. In any language.

More Hrm’s. Google kindly suggested I give the Python Imaging Library a try, so I checked out the tutorial online. “Wow. This might be doable”, I thought to myself. This looks like a really simple library.

And it was….the code below took about 3 days to write starting from “Uh, how do for/next loops work in Python again?”. So while it’s not a LONG program and it’s NOT elegant, and it CAN be done a lot better, it does the trick.

In fact, not only does it do the trick, but the code now lets you specify which image to use to recreate the base image of the mosaic. (And the concept of the art piece has followed with that, Im now using two self-portraits.)

The program I wrote is a little different from web-clients for Mosaic creation I’ve seen. Those go and grab images (often at random) from a repository and create a mosaic of another image out of them based on which filler-images already best-fit which piece of the base image. The filler images, themselves, arent altered.

In my code, the user specifies one filler image and one base image. The code then goes through and checks tone averages and alters the filler image to fit into a given section of the base image. If the filler’s average tone is higher than the current section of the base image being converted, the program darkens the filler image and then pastes it in.

The ultimate effect resulted in this image created from one base self-portrait and one (different) filler self-portrait (Click it so see the smaller faces):

The code which produces this image  can be found here:

https://sintixerr.wordpress.com/tone-altering-mosaic-generator-tamogen-in-python/#comment-2512

Please be kind…it really isn’t pretty yet and I know it :)

Finally, a snapshot of what it looked like put together at Artomatic:

Advertisements