Saving images/stimulation without drawing it

Dear all,
I would like to benefit from the capacity of psychopy to generate stimuli but without drawing these stimuli. I would just like to record what is generated but without displaying because it takes too much time.

I’m using
grating = psychopy.visual.GratingStim (to draw gabor patchs)
displaying it in a
win = psychopy.visual.Window

then I’m using
mydata = psychopy.visual.BufferImageStim
to extract it and put it in an numpy array that I’m recording.

But I don’t know how to make all that without having to
grating.draw()
win.flip()
win.close()

Then if I have 10000 gabors to draw, it’s going to take a lot of time because for each gabor it’s going to be drawn on the screen.

Is-it possible to generate some stimulations with psychopy without having to draw it ?

Thank you very much for attention.
Alain