# Save screenshot (bge) without writing to disk

This is a little odd but I need to save a screen-shot as an array (numpy array for eg) without writing to disk. The idea here is to create and then call the array once per frame in an external script so doing this...

bge.render.makeScreenshot("frame.png")


...and then converting the png takes too long to be feasible mostly due to saving the image (which is something I don't need anyway).

I'm trying to avoid digging into the rasterizer's source as it's completely foreign to me so I figured I'd ask here first. Any thoughts or suggestions would be greatly appreciated.

• Still can't decide if this is more appropriate here or SO. Kind of in between. – Snesticle Nov 20 '14 at 21:20
• Look into: glReadPixels, combine with this PNG writing function, stackoverflow.com/a/19174800/432509 – ideasman42 Nov 21 '14 at 13:47
• Thank you! A quick proof of concept worked perfectly. When I have a full script I'll post it as the answer in the off chance that someone else needs to do this. – Snesticle Nov 21 '14 at 15:14
• you could post the script you ended up with as an answer, I'm sure others would find interesting. – ideasman42 Nov 21 '14 at 15:18
• Did you make it? – Alex Azazel May 13 '16 at 7:30