42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
|
|
"""
|
||
|
|
Erstellt aza_main.png + assets/aza_main_light.ico aus dem vorhandenen Logo:
|
||
|
|
assets/Logo2.png (echter AzA-Wassertropen-Logo).
|
||
|
|
|
||
|
|
Weisser Hintergrund damit Hauptprogramm-Icon von Chat-Icon (dunkel) unterscheidbar.
|
||
|
|
Kein neues Logo, keine neue Grafik.
|
||
|
|
"""
|
||
|
|
from PIL import Image
|
||
|
|
import os
|
||
|
|
|
||
|
|
SRC = "assets/Logo2.png"
|
||
|
|
|
||
|
|
src = Image.open(SRC).convert("RGBA")
|
||
|
|
print(f"Quelle: {SRC} Groesse={src.size} Mode={src.mode}")
|
||
|
|
|
||
|
|
# --- PNG-Icons fuer Tkinter iconphoto() ---
|
||
|
|
for size, dst in [(48, "aza_main.png"), (32, "aza_main_32.png")]:
|
||
|
|
frame = src.resize((size, size), Image.LANCZOS)
|
||
|
|
bg = Image.new("RGBA", (size, size), (255, 255, 255, 255))
|
||
|
|
bg.paste(frame, (0, 0), frame)
|
||
|
|
bg.save(dst, format="PNG")
|
||
|
|
print(f"OK: {dst} ({os.path.getsize(dst)} Bytes)")
|
||
|
|
|
||
|
|
# --- ICO fuer PyInstaller EXE-Icon ---
|
||
|
|
ico_path = os.path.join("assets", "aza_main_light.ico")
|
||
|
|
ico_sizes = [(256, 256), (48, 48), (32, 32), (16, 16)]
|
||
|
|
frames = []
|
||
|
|
for s in ico_sizes:
|
||
|
|
frame = src.resize(s, Image.LANCZOS)
|
||
|
|
bg = Image.new("RGBA", s, (255, 255, 255, 255))
|
||
|
|
bg.paste(frame, (0, 0), frame)
|
||
|
|
frames.append(bg)
|
||
|
|
|
||
|
|
frames[0].save(
|
||
|
|
ico_path,
|
||
|
|
format="ICO",
|
||
|
|
sizes=ico_sizes,
|
||
|
|
append_images=frames[1:],
|
||
|
|
)
|
||
|
|
print(f"OK: {ico_path} ({os.path.getsize(ico_path)} Bytes)")
|
||
|
|
print("Fertig.")
|