board
RITHESH LED Display
Public Unreviewedby Rithesh03
A 300 x 70 mm PCB that spells RITHESH with 107 WS2812B RGB LEDs, controlled over Wi-Fi.
main
"""Wiki hero image: docs/images/wiki-hero-rithesh-led-display.png
The Wiki's billboard hero places the screenshot in a window 1075 x 1125 px (on a 1920 x 1200 canvas) with
`preserveAspectRatio="xMinYMin slice"`: the image is scaled to COVER that window from the top-left, so a wide image
is cut off on the right. Only the top 1085 px of the window are on the canvas.
This script builds an image at exactly the window's aspect (2150 x 2250 = 2 x 1075 x 1125). It places the unchanged
Version 1 front 3D render (hardware/layout-review/3d-front.png, scaled uniformly, never stretched or redrawn) in the
middle of the visible part, with plain dark background around it, so the whole board and the full word "RITHESH"
stay visible. The source image is only read.
Usage: python3 docs/tools/make_wiki_hero.py
"""
import os
from PIL import Image, ImageDraw
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
SRC = os.path.join(ROOT, "hardware", "layout-review", "3d-front.png")
OUT = os.path.join(ROOT, "docs", "images", "wiki-hero-rithesh-led-display.png")
WIN_W, WIN_H, WIN_VISIBLE_H = 1075, 1125, 1085 # billboard window (px) and its part that is on the canvas
SCALE = 2 # 2x for sharp display
W, H = WIN_W * SCALE, WIN_H * SCALE # 2150 x 2250
VISIBLE_H = WIN_VISIBLE_H * SCALE # 2170
SIDE = 80 # margin left/right (clear of the window's rounded corners)
BG = (15, 16, 19) # the billboard window colour (#0f1013)
PANEL_RADIUS = 24
def main():
src = Image.open(SRC).convert("RGB")
sw, sh = src.size
k = (W - 2 * SIDE) / sw # one factor for both directions: proportions kept
pw, ph = round(sw * k), round(sh * k)
panel = src.resize((pw, ph), Image.LANCZOS)
mask = Image.new("L", (pw, ph), 0)
ImageDraw.Draw(mask).rounded_rectangle((0, 0, pw - 1, ph - 1), PANEL_RADIUS, fill=255)
canvas = Image.new("RGB", (W, H), BG)
x, y = (W - pw) // 2, (VISIBLE_H - ph) // 2
canvas.paste(panel, (x, y), mask)
os.makedirs(os.path.dirname(OUT), exist_ok=True)
canvas.save(OUT, optimize=True)
print(f"wrote {OUT}: {W} x {H} px (aspect {W / H:.4f} = {WIN_W}:{WIN_H}); source {sw} x {sh} scaled by {k:.4f} "
f"to {pw} x {ph} at ({x}, {y}); visible part of the window = top {VISIBLE_H} px; "
f"panel bottom at {y + ph} px ({VISIBLE_H - y - ph} px above the cut)")
# proportions check
assert abs(pw / ph - sw / sh) < 0.01
if __name__ == "__main__":
main()