|
7 | 7 | """
|
8 | 8 |
|
9 | 9 | import logging
|
| 10 | +import os |
10 | 11 | import numpy as np
|
11 | 12 | import tkinter as tk
|
| 13 | +from tkinter import filedialog |
12 | 14 |
|
13 | 15 | from PIL import Image, ImageTk
|
14 | 16 | from ctypes import byref, c_float, c_uint
|
@@ -414,7 +416,24 @@ def _gui_doubleclick_right(self, event):
|
414 | 416 | self._selection_index = -1
|
415 | 417 |
|
416 | 418 | def _gui_save_image(self):
|
417 |
| - self.save_image("render_output.jpg") |
| 419 | + filename = filedialog.asksaveasfilename( |
| 420 | + initialdir=".", title="Save output as image", |
| 421 | + initialfile="render_output.jpg", |
| 422 | + defaultextension=".jpg", |
| 423 | + filetypes=( |
| 424 | + ("JPEG files", "*.jpg"), |
| 425 | + ("PNG files", "*.png"), |
| 426 | + ("TIFF 8-bit files", "*.tif*"), |
| 427 | + # sorry, have to use a different extension to be able to differentiate from 8-bit tif... |
| 428 | + ("TIFF 16-bit files", "*.tiff*") |
| 429 | + ) |
| 430 | + ) |
| 431 | + if filename: |
| 432 | + fname, fext = os.path.splitext(filename) |
| 433 | + if fext.lower() == "tiff": |
| 434 | + self.save_image(filename, bps="Bps16") |
| 435 | + else: |
| 436 | + self.save_image(filename, bps="Bps8") |
418 | 437 |
|
419 | 438 | def _gui_key_pressed(self, event):
|
420 | 439 | if event.keysym == "Control_L":
|
|
0 commit comments