Add script to generate smaller icons

This commit is contained in:
OleSTEEP 2024-03-03 00:22:03 +03:00
parent fa5f2a98eb
commit 006661cd13

21
generate_icons.py Normal file
View file

@ -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)