Data, Ecology, Art

Code Blog

From Binary to Color

Each pixel is defined by 4 values, red, green, blue and alpha. Each of these values is defined by a byte of data, so 8 bits. This graphic interface shows each bit as a black or color square, and the color is the color determined by all the bits together. Effectively, this data presents its own color. Download the app and try for yourself. Toggle A for auto mode, n for new random color, and click on any square to flip it and see the changed color. Press S to save a frame, it will be saved to your hard disk in the /data directory.

Note that the first byte is red, the second byte is green, and the third byte is blue. The fourth of course is alpha.

The code is Version 03 is linked here. To run the code, download Processing.org

Greg Niemeyer