#!/usr/bin/env python3 """Original hero portrait: the ARCHITECT OF THE VOID. Not a copy of anyone's character design. The figure is a silhouette packed with bracket glyphs — the void salesman rendered as the thing he sells. Generated from scratch: masks, glyph fill, chromatic aberration, scanlines. """ import random from PIL import Image, ImageDraw, ImageFont, ImageFilter random.seed(2024) W, H = 900, 1100 BG = (5, 6, 10) BOLD = "/usr/share/fonts/dejavu-sans-fonts/DejaVuSans-Bold.ttf" MONO = "/usr/share/fonts/google-noto/NotoSansMono-CondensedMedium.ttf" def F(p, s): try: return ImageFont.truetype(p, s) except Exception: return ImageFont.load_default() def backdrop(): img = Image.new("RGB", (W, H), BG) d = ImageDraw.Draw(img) for y in range(H): t = y / H v = int(4 + 20 * (1 - t) ** 1.4) d.line([(0, y), (W, y)], fill=(v // 3, v // 3 + 1, v)) # distant static for _ in range(1400): x, y = random.randint(0, W), random.randint(0, H) c = random.choice([(16, 18, 28), (24, 8, 20), (8, 24, 28)]) d.point((x, y), fill=c) # faint grid for x in range(0, W, 60): d.line([(x, 0), (x, H)], fill=(12, 13, 20)) for y in range(0, H, 60): d.line([(0, y), (W, y)], fill=(12, 13, 20)) return img def figure_mask(): """Head + neck + shoulders + tapering torso silhouette.""" m = Image.new("L", (W, H), 0) d = ImageDraw.Draw(m) cx = W // 2 d.ellipse([cx - 134, 146, cx + 134, 462], fill=255) # head d.polygon([(cx - 52, 430), (cx + 52, 430), (cx + 62, 556), (cx - 62, 556)], fill=255) # neck d.polygon([(cx - 62, 540), (cx + 62, 540), # shoulders (cx + 238, 604), (cx + 282, 1099), (cx - 282, 1099), (cx - 238, 604)], fill=255) return m def glyph_fill(mask): """Pack the silhouette with bracket glyphs.""" lay = Image.new("RGB", (W, H), (0, 0, 0)) d = ImageDraw.Draw(lay) glyphs = ["[[", "]]", "$$", "[]", "[", "]", "$", "#", "@", "!", "%", "&"] sizes = [14, 17, 20, 24, 28, 34, 42] y = 140 while y < H: s = random.choice(sizes) f = F(MONO, s) x = random.randint(-40, 4) while x < W: g = random.choice(glyphs) shade = random.randint(130, 255) tint = random.choice([(shade, shade, shade), (0, shade, shade), (shade, 0, shade // 2), (shade, shade // 2, 0)]) d.text((x, y), g, font=f, fill=tint) x += d.textlength(g, font=f) + random.randint(0, 7) y += s + random.randint(-2, 4) lay = lay.filter(ImageFilter.GaussianBlur(0.4)) out = Image.new("RGB", (W, H), (0, 0, 0)) out.paste(lay, (0, 0), mask) return out def chroma(img, dx=5): r, g, b = img.split() m = Image.new("L", (W, H), 0) m = ImageChops_lighter(m, r) out = img.copy() for col, off in (((0, 235, 245), -dx), ((240, 20, 160), dx)): tint = Image.new("RGB", (W, H), col) shifted = m.transform((W, H), Image.AFFINE, (1, 0, -off, 0, 1, 0)) out = Image.composite(tint, out, shifted) out = Image.composite(img, out, m) return out def ImageChops_lighter(a, b): from PIL import ImageChops return ImageChops.lighter(a, b) def eyes(img): d = ImageDraw.Draw(img) cx = W // 2 for ex in (cx - 74, cx + 26): d.rectangle([ex, 268, ex + 48, 296], fill=(255, 252, 240)) d.rectangle([ex - 4, 262, ex + 52, 302], outline=(0, 220, 235)) d.rectangle([cx - 96, 258, cx + 96, 306], outline=(240, 0, 150)) # grin d.arc([cx - 78, 330, cx + 78, 430], start=20, end=160, fill=(255, 250, 238), width=7) return img def sigils(img): d = ImageDraw.Draw(img) d.text((40, 40), "[[", font=F(BOLD, 150), fill=(30, 34, 52)) d.text((W - 200, H - 210), "]]", font=F(BOLD, 150), fill=(30, 34, 52)) d.text((W - 150, 120), "$$$", font=F(MONO, 42), fill=(190, 30, 105)) d.text((46, 210), "KROMER", font=F(MONO, 26), fill=(38, 42, 60)) d.text((46, H - 90), "ARCHITECT OF THE VOID", font=F(MONO, 24), fill=(150, 170, 190)) return img def finish(img): d = ImageDraw.Draw(img) # glitch bands, outside the face for _ in range(22): y0 = random.choice([random.randint(470, H - 30), random.randint(0, 130)]) h = random.randint(3, 20) band = img.crop((0, y0, W, min(y0 + h, H))) img.paste(band, (random.randint(-26, 26), y0)) for y in range(0, H, 4): d.line([(0, y), (W, y)], fill=(0, 0, 0)) m = Image.new("L", (W, H), 0) ImageDraw.Draw(m).ellipse([-W * .3, -H * .25, W * 1.3, H * 1.25], fill=255) m = m.filter(ImageFilter.GaussianBlur(150)) return Image.composite(img, Image.new("RGB", (W, H), (0, 0, 0)), m) def main(): img = backdrop() mask = figure_mask() fig = glyph_fill(mask) img.paste(fig, (0, 0), mask) img = chroma(img, 6) img = eyes(img) img = sigils(img) img = finish(img) out = "/home/ryzen/foryou/spamton-portrait.png" img.save(out) print("wrote", out, img.size) if __name__ == "__main__": main()