diff --git a/docs/FAQ.rst b/docs/FAQ.rst index 5d9bb330ff485c1c546b2d16319a2720b3d07ec4..5304e79541f145d4fb8abc6fefedd44772e487a4 100644 --- a/docs/FAQ.rst +++ b/docs/FAQ.rst @@ -39,3 +39,9 @@ Frequently Asked Questions (FAQs) .. _importlib-resources: https://importlib-resources.readthedocs.io/en/latest/ + + Renders the scene into a image (screenshot) + .. code-block:: python + + renderer.gl.saveImage("filename.bmp") + diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index b5b761a20b8c1cc5cb8d20f9b12d0831e8636685..40ecab96b043ecb2eddd807715c8ef3385cd135c 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -219,6 +219,10 @@ class PILGL(GraphicsLayer): return array(img) def saveImage(self, filename): + """ + Renders the current scene into a image file + :param filename: filename where to store the rendering output (supported image format *.bmp , .. , *.png) + """ img = self.alpha_composite_layers() img.save(filename)