Alternative to .getPixel()?

Is there an alternative to Image.getPixel()? I would like to use a picture as a way to store data for a map.

All I need is the ability to get the pixel color data from an image. Is this possible?

Yeah, it is. You’ll need to either do one of two things.

  1. Use an external library like PIL (I guess; I’m not sure) to load up the image, then read the data. This can be done, but it’s best to do things all in the BGE (just for ease of distribution / updating, etc). So, the better method would be to:

  2. Use the bge.texture module to load up the image, and then read the pixel color. I actually wrote a function to read the color of a image that you load in via the bge.texture module. You provide the image size and where to sample the pixel color, and it’ll return the list of the color - it’s in my Shadowmaps example here. There’s a related thread here in the Resources section, but you’ll have to search for it.

Thanks this is perfect! This will be very helpful.
I’ve looked at some of your other work, Great job there too.

No problem. Thanks, to you as well.