Friday, June 12, 2015

Programming as Art

Overview

Abstract art by Bruce Gray.
In this workshop, you will use a very simple graphics library to create images. There are plenty of "better" libraries do this kind of thing, but today is about creating with a simple set of tools.

A whole lot more can be done with this library, but these are starting points. You will know that you are getting what you should out of the workshop if:
  • You can use the manual to do new things with the library.
  • You can turn an idea into a script that reflects perfectly what you had in mind.

Background

Here are some information that you may find useful for this workshop:

What we'll do

In this workshop, we will:
  1. Discuss about coordinates in computer graphics and try a guessing game to test your "eyeballing" skills.
  2. Download a set of files from RandomBytes on GitHub
  3. Create windows and graphic object in a Python console to learn about syntax and the logic of object-based programming.
  4. Attempt to create the closest possible knockoff of the Martian Crocodile artwork to test your ability to translate ideas into precise instructions.
  5. Give you a taste of what can be done after this workshop.

Check your understanding

Try to make your own version of my Martian Crocodile artwork. First, try to make it as similar as the original. This will challenge you to translate into code exactly what you have in mind. Once that you are done, feel free to make it more interesting. Hint: I used a window that was 1000 pixels wide and 200 pixels high. 

Can you make a copy as "good" as the original?

To do this, and before you even start typing on the keyboard, decompose the image into elements. Write down possible coordinates for them. Next, find out from the documentation what object would be useful, and how to create these elements. Finally, start working on your crocodile script.

Going beyond

We have barely scratched the surface today. If you already know how to program or want to learn independently, try the challenges in Hacking One Circle. You should also browse the other scripts in the downloaded folder, you will find some interesting Python scripts there.

Have a look at this Google image search and try to figure out how you could create art using lines, boxes, ovals, circles and polygons.  

Can you generate Mondrian compositions look-alikes? 

In particular, I'd like you to have a close look at this painting from Piet Mondrian.

Composition with Yellow Red Black Blue Grey

You don't need to be a programmer to think like a computer scientist. On a piece of paper, imagine how you would create a program to generate random Mondrian Composition look-alikes. Make sure to share with me, or an helper, about your solution. We can help you to turn it into a functioning Python Script.