PIL: Image to array of values

Thomas Weholt thomas at cintra.no
Fri Aug 4 09:05:34 EDT 2000


Hi,

I was wondering if I could use something like PIL to take a image in
say 3 tones of gray and analyze the picture so that the value of a
pixel corresponded to a value in a python array or list of tuples?

Ex. 

I draw a image in three tones of gray. The lightest symbols water, the
middle tone ground and the darkest mountains. then I analyze the
image, pixel by pixel, and puts the result into a list with x and y
info. If the pixel is dark, I put the values of the x and y coord. and
the terrain value to 2 for mountain. Something like that.

Is there any other way of doing this?

 What I want is to draw the terrain/map in a plain drawing-app and
then use the image as foundation for a AI-simulator where robots learn
how to move in the generated terrain, remembers paths and how to get
from one point on the map to another. 

Thomas





More information about the Python-list mailing list