#156 scaling down full window screenshot

This commit is contained in:
Adam Saudagar 2023-03-09 15:38:50 +05:30
parent 0c3b5da26b
commit cc61caf12d
2 changed files with 6 additions and 3 deletions

View File

@ -101,4 +101,4 @@ class WindowClient:
if WindowServer.status == Status.CRASHED:
return
helper.save_img(self.show_name, img)
helper.save_img(self.show_name, img, True)

View File

@ -209,12 +209,15 @@ def print_exc():
traceback.print_exc()
def save_img(show_name, img):
def save_img(show_name, img, half=False):
img_path = os.path.join(os_services.get_documents_path(), "fishy_debug", "imgs", show_name)
if not os.path.exists(img_path):
os.makedirs(img_path)
if half:
img = cv2.resize(img, (0, 0), fx=0.5, fy=0.5)
t = time.strftime("%Y.%m.%d.%H.%M.%S")
cv2.imwrite(
os.path.join(img_path, f"{t}.png"),
os.path.join(img_path, f"{t}.jpg"),
img)