forked from Shinonome/dots-hyprland
improve auto color scheme performance
This commit is contained in:
@@ -35,6 +35,16 @@ def pick_scheme(colorfulness):
|
||||
else:
|
||||
return "scheme-tonal-spot"
|
||||
|
||||
def load_and_resize_image(img_path, max_dim=128):
|
||||
img = cv2.imread(img_path)
|
||||
if img is None:
|
||||
return None
|
||||
h, w = img.shape[:2]
|
||||
if max(h, w) > max_dim:
|
||||
scale = max_dim / max(h, w)
|
||||
img = cv2.resize(img, (int(w * scale), int(h * scale)), interpolation=cv2.INTER_AREA)
|
||||
return img
|
||||
|
||||
def main():
|
||||
colorfulness_mode = False
|
||||
args = sys.argv[1:]
|
||||
@@ -45,7 +55,7 @@ def main():
|
||||
print("scheme-tonal-spot")
|
||||
sys.exit(1)
|
||||
img_path = args[0]
|
||||
img = cv2.imread(img_path)
|
||||
img = load_and_resize_image(img_path)
|
||||
if img is None:
|
||||
print("scheme-tonal-spot")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user