Spamton / make_banner.py
Bejczy's picture
Upload make_banner.py with huggingface_hub
2c9d9d2 verified
Raw History Blame Contribute Delete
3.44 kB
#!/usr/bin/env python3
"""Banner v2 — glitch the BACKGROUND, keep the TYPE readable.
v1 applied the corruption after the text and destroyed legibility. A model card
banner still has to be readable at thumbnail size, so the noise lives behind the
type and the text gets only chromatic aberration, not slicing.
Original artwork only: typography, grid, signal corruption. No game assets.
"""
import random
from PIL import Image, ImageDraw, ImageFont, ImageFilter
random.seed(1997)
W, H = 1280, 640
BG = (7, 8, 14)
INK = (245, 244, 236)
CYAN = (0, 226, 240)
MAG = (238, 20, 155)
AMBER = (255, 190, 70)
DIM = (128, 138, 162)
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 background():
img = Image.new("RGB", (W, H), BG)
d = ImageDraw.Draw(img)
for y in range(H):
t = y / H
v = int(10 + 26 * (1 - t) ** 1.6)
d.line([(0, y), (W, y)], fill=(v // 3, v // 3 + 1, v))
for x in range(0, W, 40):
d.line([(x, 0), (x, H)], fill=(17, 19, 30))
for y in range(0, H, 40):
d.line([(0, y), (W, y)], fill=(17, 19, 30))
# a few background glitch bars, well away from the text column
for _ in range(18):
y0 = random.randint(0, H - 1)
h = random.randint(2, 18)
x0 = random.randint(0, W - 200)
w = random.randint(60, 320)
c = random.choice([(30, 34, 50), (26, 8, 24), (8, 30, 34)])
d.rectangle([x0, y0, x0 + w, min(y0 + h, H)], fill=c)
return img
def chroma_text(img, txt, xy, fnt, fill=INK, dx=3):
lay = Image.new("L", (W, H), 0)
ImageDraw.Draw(lay).text(xy, txt, font=fnt, fill=255)
out = img.copy()
for col, off in ((CYAN, -dx), (MAG, dx)):
tint = Image.new("RGB", (W, H), col)
out = Image.composite(tint, out, lay.transform(
(W, H), Image.AFFINE, (1, 0, -off, 0, 1, 0)))
core = Image.new("RGB", (W, H), fill)
return Image.composite(core, out, lay)
def main():
img = background()
d = ImageDraw.Draw(img)
img = chroma_text(img, "SPAMTON", (56, 118), F(BOLD, 104), INK, 4)
img = chroma_text(img, "G. SPAMTON", (56, 226), F(BOLD, 104), INK, -4)
d = ImageDraw.Draw(img)
d.text((60, 356), "[[ARCHITECT OF THE VOID]]", font=F(MONO, 44), fill=AMBER)
d.text((60, 424), "A BIG SHOT IN EVERY [[TOKEN]] $$$", font=F(MONO, 28), fill=(160, 220, 220))
d.text((60, 466), "0.8B · LoRA fine-tune of Qwen3.5-0.8B · Q4_K_M",
font=F(MONO, 26), fill=DIM)
# bracket motifs, placed clear of the type
d.text((1012, 300), "]", font=F(BOLD, 240), fill=(46, 50, 74))
d.text((1030, 96), "[", font=F(BOLD, 190), fill=(40, 44, 66))
d.text((1086, 300), "$$$", font=F(MONO, 34), fill=(190, 40, 110))
# light scanlines, then vignette
d = ImageDraw.Draw(img)
for y in range(0, H, 4):
d.line([(0, y), (W, y)], fill=(2, 2, 4))
m = Image.new("L", (W, H), 0)
ImageDraw.Draw(m).ellipse([-W * .3, -H * .4, W * 1.3, H * 1.4], fill=255)
m = m.filter(ImageFilter.GaussianBlur(140))
img = Image.composite(img, Image.new("RGB", (W, H), (0, 0, 0)), m)
out = "/home/ryzen/foryou/spamton-banner.png"
img.save(out)
print("wrote", out, img.size)
if __name__ == "__main__":
main()