Cellular Automata based on pixelated images

Dear everyone, I am a newbie to processing. As I proceeds, I am very interested in the thinking of Cellular Automata (part of lesson from The Nature of Code by Daniel Shiffman).

I really want to create a version based on pixelate images that have the same rule as “Nested”: each pixelated (b/w) Images (consist of X pixels) can be zoom out and turns into 1 single cell, and further zoom out will be another image that again become a cell when zoom out? And vice versa with zooming in. It is like the game of eternal images when you scrolls in mouse, but base on a cell = fake 1 pixel.

I hope I made it clear? I already have image that are pixelated, but I wonder how can I proceed? How can processing generate an image in to numbers of pixel (its already does)but how do we control the pixel and assign to it a task and behavior?

thank you so much!

1 Like

this kind of question are not easy to answer.

-a- why you not link to what you are talking about ? this?

-b- you say you have code and images ?
can you post here and show?

-c- based on your code ( project status ) what would you like to do next?


Sounds do-able.

1 keep and array of images the size of your pixel field.
2 code the game of life.
3 implement a zooming mechanism which triggers a function in setup to reset the grid and base its new values on the image found in that array for that particular cell.

Things to keep in mind, if you’re keeping an array of images how is it managed, ie is it a 1d array a 2d array or a 3d array.

If its a 1d or 2d array the array would probably need to be shuffled everytime you zoom in or out or have some other method of avoiding the issue of zooming on the same square, which would lead to you just entering the same grid again. This comes at the cost of not having any predictability, but also means it would essentially be infinite.

Also for all dimension you would need to make sure you double the images to account for zoom in or zoom out.

Main caveat here I think would be finding that many images, unless your relying on reusing some images.


When you say “image”, what do you mean, concretely? Like, a 32x32 black and white icon of an apple? Or do you mean an image of another game of life board, with gliders and glider guns etc.?

Can you zoom into white pixels only, or black only, or white and black? My first observation would be that functioning / interesting game of life boards are usually sparse. You might want to flip-flop between black meaning “live” and white meaning “live” depending on which type of pixel you are zooming into. You could always just randomly generate all of them, with no source images –


1 Like

Hi Jeremy,

It is very much like the Inside the Star-filled sky.
I am a very beginner with programming, however, I want to work on an art installation where I created Bit-map photography, it is suddenly very interesting to zoom in the pixels of the bitmap and I imagine there go another image inside of it.
Based on the Cellular Automata, I want to create a game that the pixel can interact with each other and give birth to the new generation of pixel based on these rule. I will attach the code here.

Instead of the pixel of this canvas, the photo is 1024x738 pixels. Is it possible to create a certain shape for the bitmap other than just square/diamond or cross? and how to create an infinite zoom like the game you showed?

Thank you.

// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com

// Daniel Shiffman, Nature of Code

// A basic implementation of John Conway's Game of Life CA
// how could this be improved to use object oriented programming?
// think of it as similar to our particle system, with a "cell" class
// to describe each individual cell and a "cellular automata" class
// to describe a collection of cells

// Cells wrap around

GOL gol;

void setup() {
  size(400, 400);
  gol = new GOL();

void draw() {


// reset board when mouse is pressed
void mousePressed() {

These two ideas – zooming photos, and zooming automata-fields – may be tricky to connect. How do the cellular automata interact with the photos? Is the photo the top level, and each pixel is a full game of life, and there are only two levels? If you run a CA algorithm on a photo, it stops being a photo almost immediately.

If you are interested in nested photos (without CA), you might want to check out this recent project:

For putting CA fields in an image, the main challenge is that, in order to “read” as b/w pixels, your images must either be mostly black or mostly white. So you might want two different display styles of sparse CAs – one with active black pixels on white, one with active white pixels on black.

If you want to cycle back and forth between photos and CAs, you could use the 2001 trick, only bounce – zoom from photo into CA, then zoom from CA out to a new photo, then in, then out. One “trick” used by the 2001 project is to arbitrarily replace the center pixel in the target photo with the next one in the sequence, so that any transition sequence is valid.