From 24cb4f8423966d019ed26375a0c70bc2d345b827 Mon Sep 17 00:00:00 2001 From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch> Date: Fri, 5 Jul 2019 12:33:00 +0200 Subject: [PATCH] FAQ --- docs/FAQ.rst | 6 ++++++ flatland/utils/graphics_pil.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/docs/FAQ.rst b/docs/FAQ.rst index 5d9bb33..5304e79 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 b5b761a..40ecab9 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) -- GitLab