I am looking for a way to create an Array with the RGB values of each pixel in an screenshot taken using this: var image = get_viewport().get_texture().get_data()

Is there an easier way to do this than manualy iterating with two nested for loops?

If the answer is no, is there any way to get an array with gray scale values instead or even binary (black and white) ?

Any ideas are welcome :)

You can use "get_pixel(x,y)" that will return a color for a specific index. In that case you would need two loops.

If you need to process the pixels, that might be the best way cause you can work with RGB directly.

2 years later