Add script to generate smaller icons
This commit is contained in:
parent
fa5f2a98eb
commit
006661cd13
1 changed files with 21 additions and 0 deletions
21
generate_icons.py
Normal file
21
generate_icons.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue