From 006661cd139e44c586aa2ce1fe338d68e2b782c9 Mon Sep 17 00:00:00 2001 From: OleSTEEP Date: Sun, 3 Mar 2024 00:22:03 +0300 Subject: [PATCH] Add script to generate smaller icons --- generate_icons.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 generate_icons.py diff --git a/generate_icons.py b/generate_icons.py new file mode 100644 index 0000000..34ec7ed --- /dev/null +++ b/generate_icons.py @@ -0,0 +1,21 @@ +#/usr/bin/env python3 +import cv2 + +original_icons = ["ic_launcher_background.png", + "ic_launcher_foreground.png", + "ic_launcher_monochrome.png", + "ic_launcher.png"] + +resolutions = [ + ["ldpi", 36, cv2.INTER_AREA], + ["mdpi", 48, cv2.INTER_AREA], + ["hdpi", 72, cv2.INTER_AREA], + ["xhdpi", 216, cv2.INTER_NEAREST], + ["xxhdpi", 324, cv2.INTER_NEAREST]] + +for res in resolutions: + for icon in original_icons: + image = cv2.imread(f"res/android/xxxhdpi/{icon}", cv2.IMREAD_UNCHANGED) + print(f"* [{res[0]}] {icon}") + resize = cv2.resize(image, (res[1], res[1]), interpolation=res[2]) + cv2.imwrite(f"res/android/{res[0]}/{icon}", resize) \ No newline at end of file