Each lib has its own way of interpreting image arrays. By turning, I suppose you mean transposed. The way PyGame shows multiple arrays. There are many ways to make it look βright.β There are actually many ways to show an array that gives you full control over the presentation of channels, etc. In pygame version 1.9.2, this is the fastest array I could reach. (Note for an earlier version this will not work!). This function will fill the surface with an array:
def put_array(surface, myarr):
If this does not work, use this should work everywhere:
You probably still don't get what you want, so it wraps or changes color channels. The idea is to manage arrays in this form, which assigns this surface buffer. To find out what the correct order of the order and axis is, use the openCV library (cv2.imread (file name)). With openCV, you open images in the BGR standard as standard and has many conversion functions. If I remember correctly, when writing directly to a surface buffer, BGR is the correct order for 24 bits and BGRA for a 32-bit surface. Thus, you can try to put an array of images that you select from the file with this function and blit on the screen.
There are other ways to draw arrays, for example. there is a whole set of helper functions http://www.pygame.org/docs/ref/surfarray.html
But I would not recommend using it, since surfaces are not designed to manipulate pixels directly, you are likely to lose links. A little tip: to perform an "alarm test" use an image, for example. This way, you will immediately see that something is wrong, just load the array and try to do it.

Mikhail V
source share