Self-Documenting ruby t-shirt

For reasons I don't really understand myself, recently I've been messing about with the idea of code on t-shirts. Sure, it's not exactly a new idea, but I couldn't resist it. I started out with this Lisp t-shirt (mainly because I wanted one myself, the order is in and I'm looking forward to getting it) and then went on and did this one (which I'll probably end up buying at some point in the near future).

And then I got to thinking that it might be interesting to have a go at creating a t-shirt that was, in effect, self-documenting. The idea being that the design would contain code that would, as much as possible, be usable in creating the design. After thinking on this for a while I decided that a Mandelbrot set would be a good place to start.

Having already done some Lisp I thought it was time to do something with ruby. So, I sat down and knocked up a quick script that would plot a Mandelbrot set, emitting it as a PBM file, just to make life easier. I then converted that to a PNG. After that I loaded up Photoshop Elements, created an empty image sized correctly for a RedBubble t-shirt design, added in the Mandelbrot and then layered the ruby source code over the top. A tweak or two later and I had a finished design:

I'm rather pleased with the result.

That said, the idea still needs some more work. While the shirt contains the code to produce the background image it's not a fully self-documenting t-shirt in that running the code on the shirt won't produce the whole design. That's to say: you can't run the code and get a PNG that's ready to upload to RedBubble.

I think a bit of reading of the documentation for RMagick is in order.


  1. How about having the design on the front and the code on the back.

  2. Yeah, that'd be an option (well, it will be once RedBubble have front and back printing on the go).