Skip to content

Commit

Permalink
Added support for multiple file formats
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov committed Apr 24, 2024
1 parent f3103ba commit f3266ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions brainrender/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ def screenshot(self, name=None, scale=None):
self.render(interactive=False)

timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
name = name or f"brainrender_screenshot_{timestamp}"
if ".png" not in name:
name += ".png"
name = Path(name or f"brainrender_screenshot_{timestamp}")

# If no suffix is provided or it an unsupported format, default to .png
if name.suffix not in [".png", ".eps", ".pdf", ".svg", ".jpg"]:
name = name.with_suffix(".png")

scale = scale or settings.SCREENSHOT_SCALE

Expand Down

0 comments on commit f3266ef

Please sign in to comment.