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? ( . . more . . )

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.

( . . more . . )

as many as it takes

allRGB: images in which each of 16 million colors occurs exactly once. (Found at MathPuzzle.) I see I’m not the only one to think of the Hilbert curve idea, but I’ll post two others.

In unrelated news, I was surprised today to find some late blackberries, bland but wholesome.

more chainmail

This image, which I made a few years ago, is based on a tiling of the hyperbolic plane with triangles whose angles are π/2, π/3, π/7. Other than the 7, which can be changed to any higher integer, I couldn’t vary these numbers without ruining the effect. Recently I thought of a simpler, and thus more general, way to generate the ribbons.

( . . more . . )

Hilbert’s palette

A space-filling path through this square is matched to an analogous path through the color-cube.

I had this idea in mind for years but the algorithm for Hilbert’s curve defeated me; then I stumbled on Steve Witham’s Python code, and whipped up this doodle in half an hour.