Bejczy commited on
Commit
2c9d9d2
·
verified ·
1 Parent(s): 4c2f569

Upload make_banner.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. make_banner.py +100 -0
make_banner.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Banner v2 — glitch the BACKGROUND, keep the TYPE readable.
3
+
4
+ v1 applied the corruption after the text and destroyed legibility. A model card
5
+ banner still has to be readable at thumbnail size, so the noise lives behind the
6
+ type and the text gets only chromatic aberration, not slicing.
7
+
8
+ Original artwork only: typography, grid, signal corruption. No game assets.
9
+ """
10
+ import random
11
+ from PIL import Image, ImageDraw, ImageFont, ImageFilter
12
+
13
+ random.seed(1997)
14
+ W, H = 1280, 640
15
+ BG = (7, 8, 14)
16
+ INK = (245, 244, 236)
17
+ CYAN = (0, 226, 240)
18
+ MAG = (238, 20, 155)
19
+ AMBER = (255, 190, 70)
20
+ DIM = (128, 138, 162)
21
+
22
+ BOLD = "/usr/share/fonts/dejavu-sans-fonts/DejaVuSans-Bold.ttf"
23
+ MONO = "/usr/share/fonts/google-noto/NotoSansMono-CondensedMedium.ttf"
24
+
25
+
26
+ def F(p, s):
27
+ try:
28
+ return ImageFont.truetype(p, s)
29
+ except Exception:
30
+ return ImageFont.load_default()
31
+
32
+
33
+ def background():
34
+ img = Image.new("RGB", (W, H), BG)
35
+ d = ImageDraw.Draw(img)
36
+ for y in range(H):
37
+ t = y / H
38
+ v = int(10 + 26 * (1 - t) ** 1.6)
39
+ d.line([(0, y), (W, y)], fill=(v // 3, v // 3 + 1, v))
40
+ for x in range(0, W, 40):
41
+ d.line([(x, 0), (x, H)], fill=(17, 19, 30))
42
+ for y in range(0, H, 40):
43
+ d.line([(0, y), (W, y)], fill=(17, 19, 30))
44
+ # a few background glitch bars, well away from the text column
45
+ for _ in range(18):
46
+ y0 = random.randint(0, H - 1)
47
+ h = random.randint(2, 18)
48
+ x0 = random.randint(0, W - 200)
49
+ w = random.randint(60, 320)
50
+ c = random.choice([(30, 34, 50), (26, 8, 24), (8, 30, 34)])
51
+ d.rectangle([x0, y0, x0 + w, min(y0 + h, H)], fill=c)
52
+ return img
53
+
54
+
55
+ def chroma_text(img, txt, xy, fnt, fill=INK, dx=3):
56
+ lay = Image.new("L", (W, H), 0)
57
+ ImageDraw.Draw(lay).text(xy, txt, font=fnt, fill=255)
58
+ out = img.copy()
59
+ for col, off in ((CYAN, -dx), (MAG, dx)):
60
+ tint = Image.new("RGB", (W, H), col)
61
+ out = Image.composite(tint, out, lay.transform(
62
+ (W, H), Image.AFFINE, (1, 0, -off, 0, 1, 0)))
63
+ core = Image.new("RGB", (W, H), fill)
64
+ return Image.composite(core, out, lay)
65
+
66
+
67
+ def main():
68
+ img = background()
69
+ d = ImageDraw.Draw(img)
70
+
71
+ img = chroma_text(img, "SPAMTON", (56, 118), F(BOLD, 104), INK, 4)
72
+ img = chroma_text(img, "G. SPAMTON", (56, 226), F(BOLD, 104), INK, -4)
73
+
74
+ d = ImageDraw.Draw(img)
75
+ d.text((60, 356), "[[ARCHITECT OF THE VOID]]", font=F(MONO, 44), fill=AMBER)
76
+ d.text((60, 424), "A BIG SHOT IN EVERY [[TOKEN]] $$$", font=F(MONO, 28), fill=(160, 220, 220))
77
+ d.text((60, 466), "0.8B · LoRA fine-tune of Qwen3.5-0.8B · Q4_K_M",
78
+ font=F(MONO, 26), fill=DIM)
79
+
80
+ # bracket motifs, placed clear of the type
81
+ d.text((1012, 300), "]", font=F(BOLD, 240), fill=(46, 50, 74))
82
+ d.text((1030, 96), "[", font=F(BOLD, 190), fill=(40, 44, 66))
83
+ d.text((1086, 300), "$$$", font=F(MONO, 34), fill=(190, 40, 110))
84
+
85
+ # light scanlines, then vignette
86
+ d = ImageDraw.Draw(img)
87
+ for y in range(0, H, 4):
88
+ d.line([(0, y), (W, y)], fill=(2, 2, 4))
89
+ m = Image.new("L", (W, H), 0)
90
+ ImageDraw.Draw(m).ellipse([-W * .3, -H * .4, W * 1.3, H * 1.4], fill=255)
91
+ m = m.filter(ImageFilter.GaussianBlur(140))
92
+ img = Image.composite(img, Image.new("RGB", (W, H), (0, 0, 0)), m)
93
+
94
+ out = "/home/ryzen/foryou/spamton-banner.png"
95
+ img.save(out)
96
+ print("wrote", out, img.size)
97
+
98
+
99
+ if __name__ == "__main__":
100
+ main()