Files
999/scripts/apply_new_logo.py
T

76 lines
3.1 KiB
Python

import os
from PIL import Image, ImageDraw
SRC_IMAGE = '/home/alexives/.gemini/antigravity-ide/brain/4ff924d9-3d7f-4202-9066-3ac5c3088b8e/star_13_flush_micropixel_perfection.png'
src = Image.open(SRC_IMAGE).convert('RGBA')
# 1. Update assets/icons
src.resize((1024, 1024), Image.Resampling.LANCZOS).save('assets/icons/app_icon_1024.png', 'PNG')
src.resize((512, 512), Image.Resampling.LANCZOS).save('assets/icons/app_icon_512.png', 'PNG')
src.resize((512, 512), Image.Resampling.LANCZOS).save('scripts/app_icon_master.png', 'PNG')
# 2. Update Android mipmap densities
android_densities = {
'android/app/src/main/res/mipmap-mdpi': 48,
'android/app/src/main/res/mipmap-hdpi': 72,
'android/app/src/main/res/mipmap-xhdpi': 96,
'android/app/src/main/res/mipmap-xxhdpi': 144,
'android/app/src/main/res/mipmap-xxxhdpi': 192,
}
for folder, sz in android_densities.items():
os.makedirs(folder, exist_ok=True)
# Square / standard icon
resized = src.resize((sz, sz), Image.Resampling.LANCZOS)
resized.save(os.path.join(folder, 'ic_launcher.png'), 'PNG')
# Round icon (with circular alpha mask)
mask = Image.new('L', (sz, sz), 0)
draw = ImageDraw.Draw(mask)
draw.ellipse((0, 0, sz, sz), fill=255)
round_img = Image.new('RGBA', (sz, sz), (0, 0, 0, 0))
round_img.paste(resized, (0, 0), mask)
round_img.save(os.path.join(folder, 'ic_launcher_round.png'), 'PNG')
print(f"Updated Android {folder}: {sz}x{sz}")
# 3. Update Web icons
src.resize((16, 16), Image.Resampling.LANCZOS).save('web/favicon.png', 'PNG')
src.resize((192, 192), Image.Resampling.LANCZOS).save('web/icons/Icon-192.png', 'PNG')
src.resize((512, 512), Image.Resampling.LANCZOS).save('web/icons/Icon-512.png', 'PNG')
src.resize((192, 192), Image.Resampling.LANCZOS).save('web/icons/Icon-maskable-192.png', 'PNG')
src.resize((512, 512), Image.Resampling.LANCZOS).save('web/icons/Icon-maskable-512.png', 'PNG')
print("Updated Web icons")
# 4. Update iOS icons
ios_folder = 'ios/Runner/Assets.xcassets/AppIcon.appiconset'
if os.path.exists(ios_folder):
for f in os.listdir(ios_folder):
if f.endswith('.png'):
path = os.path.join(ios_folder, f)
with Image.open(path) as existing:
cur_sz = existing.size
src.resize(cur_sz, Image.Resampling.LANCZOS).save(path, 'PNG')
print(f"Updated iOS {f}: {cur_sz}")
# 5. Update MacOS icons
macos_folder = 'macos/Runner/Assets.xcassets/AppIcon.appiconset'
if os.path.exists(macos_folder):
for f in os.listdir(macos_folder):
if f.endswith('.png'):
path = os.path.join(macos_folder, f)
with Image.open(path) as existing:
cur_sz = existing.size
src.resize(cur_sz, Image.Resampling.LANCZOS).save(path, 'PNG')
print(f"Updated macOS {f}: {cur_sz}")
# 6. Windows ICO
src.resize((256, 256), Image.Resampling.LANCZOS).save(
'windows/runner/resources/app_icon.ico',
format='ICO',
sizes=[(16, 16), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]
)
print("Updated Windows icon")
print("All platforms successfully updated with the cosmic Chrome-999 logo!")