fun with colors

Here, have a couple of Python scripts. Each creates an image file, 2^12 pixels square, each pixel of a different color.

colorshuffle.py puts the coordinates of each pixel in Gray code, assigns each bit to one of the color channels, and converts each channel back from Gray code to choose a color. The assignment is chosen at random from 141926400 possibilities.

colorfold.py is my attempt to re-create and extend this: it folds the square eight times to make a cube fitting the color space. The interesting part was maintaining continuity through multiple folds. This one has only 107520 possible outcomes; again they’re chosen at random. I don’t like the result nearly as much as the other, but you might!

You’ll need Python Imaging Library.

On my machine each takes less than two minutes, so with a simple shell script you can whip up hundreds overnight.

Here are lines folded four times, left over right or right over left. Half of the cases have a small continuity flaw near the original ends; I’ll look into that later.

This entry was posted in eye-candy, neep-neep. Bookmark the permalink.

3 Responses to fun with colors

  1. Kristen says:

    This is a topic that is near to my heart… Cheers!
    Exactly where are your contact details though?

    Here is my web page: Kristen

  2. Anton says:

    The continuity flaw happens when an angle falls within the shear zone, rather than in one of the small zones that are merely rotated (or on the boundary). So I’ll think about how to exclude those cases.

    In this limited sample, it happens when the second and third folds are in the same direction.

Leave a Reply

Your email address will not be published. Required fields are marked *