-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogo.py
More file actions
40 lines (30 loc) · 1010 Bytes
/
Copy pathlogo.py
File metadata and controls
40 lines (30 loc) · 1010 Bytes
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
import os
from PIL import Image
# Path to your Flutter project
PROJECT_PATH = "android/app/src/main/res"
# Input logo (must be square, recommended 1024x1024)
INPUT_IMAGE = "logo.png"
# Output icon name
ICON_NAME = "ic_launcher.png"
# Icon sizes for Android
sizes = {
"mipmap-mdpi": 48,
"mipmap-hdpi": 72,
"mipmap-xhdpi": 96,
"mipmap-xxhdpi": 144,
"mipmap-xxxhdpi": 192,
}
def generate_icons():
if not os.path.exists(INPUT_IMAGE):
print(f"❌ {INPUT_IMAGE} not found. Put your photo in this folder.")
return
img = Image.open(INPUT_IMAGE).convert("RGBA")
for folder, size in sizes.items():
out_dir = os.path.join(PROJECT_PATH, folder)
os.makedirs(out_dir, exist_ok=True)
resized = img.resize((size, size), Image.LANCZOS)
output_path = os.path.join(out_dir, ICON_NAME)
resized.save(output_path, format="PNG")
print(f"✅ Saved {output_path} ({size}x{size})")
if __name__ == "__main__":
generate_icons()