Cellular automata and image manipulation

John Bauman john at baumanfamily.com
Sat May 13 19:56:59 EDT 2006


<defcon8 at gmail.com> wrote in message 
news:1147561778.799956.154770 at d71g2000cwd.googlegroups.com...
> Hello. I have recently been experimenting with cellular automata and I
> would like to know how I could convert a 2d list of 0's and 1's into
> white and black squares on an image. I have tried to install matplotlib
> and also NumTut but both to no avail. There seem to be bugs in their
> installation and I have not been able to figure out how to resolve
> them. I would be happy for someone to suggest a library and maybe give
> a simple example of how to do what I want to do.
>
In my 1d cellular automaton, I used the python image library and
import Image
nim = Image.new("1", (height * 2, height))
nim.putdata(bimg)
nim.resize((400,200)).save("output.png")

where bimg is a 2d list of 0's and 1's. You could probably remove the 
resize. 





More information about the Python-list mailing list