-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch_image.py
40 lines (31 loc) · 996 Bytes
/
fetch_image.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from PyQt6.QtWidgets import QFileDialog
from PIL import Image
from update_status_info import update_status
from data_handler import set_image_path
supported_image_type = (
".jpg",
".jpeg",
".png",
".JPG",
".JPEG",
".PNG"
)
def validate_image():
image = Image.open(image_path)
if image.size[0] > 1024 and image.size[1] > 1024:
return True
return False
def select_image(self):
global new_image_selected, image_path
content = QFileDialog.getOpenFileName(
directory="./", filter="Image File, *.jpg *.jpeg *.jfif *.png", caption="Select App Image")
image_path = content[0]
if image_path != "":
if validate_image():
set_image_path(self, image_path)
update_status(self)
else:
set_image_path(self, "")
update_status(self)
self.label_status.setText("Image size must be atleast 1024 x 1024")
self.label_status.setStyleSheet("color: orange")