Category Archives: eye-candy

mutant dragons

In 2007 I thought of a pretty way to paint a square so that all pixels are different, but similar colors are clustered. For each pixel, set x,y to its coordinates; if their sum is odd, set the low bit of one of the color channels to 1. Replace x,y with (-x+y)>>1, (-x-y)>>1; this has the effect of rotating the grid by 3/8 turn and shrinking it by a factor of √2, so that the former even points, which formed a larger oblique grid, now fall on the original grid, and the odd points have their new half-coordinates truncated away. Repeat until a bit has been assigned to each bit of the three color channels.

(More concisely: considering the pixel’s coordinates as a complex number, express it as a bit string in base (-1+i).)

Colors that match in their higher bits form twindragon fractals, thus:

In 2012, I thought: what if the rotation alternates clockwise and counterclockwise?

A bit on the boring side.

But in 2017, I thought: what about less trivial sequences? Continue reading

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.

Continue reading