modified: demo.py
modified: f512418272.png
This commit is contained in:
BIN
cache/f512418272.png
vendored
BIN
cache/f512418272.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 85 KiB |
6
demo.py
6
demo.py
@@ -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)
|
||||
|
||||
BIN
f512418272.png
BIN
f512418272.png
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 85 KiB |
Reference in New Issue
Block a user