modified: demo.py

modified:   f512418272.png
This commit is contained in:
vb
2025-10-10 14:27:34 +02:00
parent f218af4810
commit 0926f37b38
3 changed files with 4 additions and 2 deletions

BIN
cache/f512418272.png vendored

Binary file not shown.

View File

@@ -117,10 +117,11 @@ def _cache_image(image, file_path):
_open_image(newfname)
def _save_image(image, file_path, product_name):
def _save_image(file_path):
image = cv2.imread(file_path)
opened_image_basename = os.path.basename(file_path)
opened_image_path = os.path.dirname(file_path)
newfname = opened_image_path + '/' + product_name + '_' + opened_image_basename
newfname = opened_image_path + '/../' + opened_image_basename
cv2.imwrite(newfname, image)
print(f"Image saved as '{newfname}'.")
_open_image(newfname)
@@ -167,6 +168,7 @@ if __name__ == "__main__":
file_menu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="File", menu=file_menu)
file_menu.add_command(label="Open Image", command=open_image)
file_menu.add_command(label="Save Image", command=lambda: _save_image(OPENED_IMAGE))
file_menu.add_command(label="Exit", command=root.quit)
test_menu = tk.Menu(menu, tearoff=0)

Binary file not shown.