This commit is contained in:
2026-06-19 11:32:49 +02:00
parent a51d22649a
commit 437056cfc4
2 changed files with 0 additions and 6453 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,43 +0,0 @@
from PIL import Image
INPUT = "/home/gabriel/Downloads/Logo.png"
OUTPUT = "/home/gabriel/Downloads/logo_splash.h"
DISPLAY_W, DISPLAY_H = 240, 320
BG_COLOR = (30, 30, 30) # dark background, change to (0,0,0) for pure black
img = Image.open(INPUT).convert("RGB")
# Scale logo to fit within display, preserving aspect ratio
img.thumbnail((DISPLAY_W, DISPLAY_H), Image.LANCZOS)
# Center on display canvas
canvas = Image.new("RGB", (DISPLAY_W, DISPLAY_H), BG_COLOR)
x = (DISPLAY_W - img.width) // 2
y = (DISPLAY_H - img.height) // 2
canvas.paste(img, (x, y))
# Convert to RGB565
pixels = []
for r, g, b in canvas.getdata():
rgb565 = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)
# Swap bytes for ILI9341 (big-endian over SPI)
pixels.append(((rgb565 & 0xFF) << 8) | (rgb565 >> 8))
# Write header file
with open(OUTPUT, "w") as f:
f.write("#pragma once\n")
f.write("#include <pgmspace.h>\n\n")
f.write(f"// {DISPLAY_W}x{DISPLAY_H} RGB565, big-endian\n")
f.write(f"const uint16_t SPLASH_WIDTH = {DISPLAY_W};\n")
f.write(f"const uint16_t SPLASH_HEIGHT = {DISPLAY_H};\n\n")
f.write("const uint16_t splash_logo[] PROGMEM = {\n")
for i, p in enumerate(pixels):
if i % 12 == 0:
f.write(" ")
f.write(f"0x{p:04X},")
if i % 12 == 11:
f.write("\n")
f.write("\n};\n")
print(f"Done — {len(pixels)} pixels, {len(pixels)*2/1024:.1f} KB")
print(f"Output: {OUTPUT}")