-
This is more of a curiosity, but I guess it could be handy to be able to run py5 on a standard Python interpreter without a window, it could be a way of integrating with other Python automation scripts (or maybe on a server?). I remember that PDF and SVG renderers can output directly to a file as described in https://py5coding.org/reference/sketch_size.html and you need to remember to call the Is there an analogous way of generating a PNG without triggering a window/surface? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, there are two ways, but it might still require a frame buffer (display) for it to run (I don't remember right now). First, you can use the special The other option is to use the py5 functions https://py5coding.org/reference/py5functions_render.html If you use a OpenGL renderer, it must briefly open a window to draw anything. There is no way for an OpenGL renderer to run without an actual open window. |
Beta Was this translation helpful? Give feedback.
Yes, there are two ways, but it might still require a frame buffer (display) for it to run (I don't remember right now).
First, you can use the special
HIDDEN
renderer, iepy5.size(200, 200, py5.HIDDEN)
. It inherits from the Java2D renderer and does not open a window. This renderer exists specifically to provide a better experience for py5bot and other times I don't want py5 to open a window. This renderer isn't really advertised anywhere and basically exists for internal purposes.The other option is to use the py5 functions
py5.render_frame()
or the associated decorator@render()
. They will return a PIL image that you can then save to a PNG file.https://py5coding.org/reference/py5funct…