aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / scripts / og-cards.py
| 1 | #!/usr/bin/env python3 |
| 2 | """Draw the social cards (1200 x 630 PNG) in the site's look. |
| 3 | |
| 4 | Near-black ground, a faint grid, a blue and a green glow, the name, one |
| 5 | claim, one line under it, and the page address. Fonts are rendered into |
| 6 | the PNG here, so the site itself loads no outside font. Run from the repo |
| 7 | root with any Python that has Pillow: |
| 8 | |
| 9 | python3 scripts/og-cards.py |
| 10 | |
| 11 | Every card is listed in CARDS; the Rust builder maps pages to these files |
| 12 | in crates/site-builder/src/seo.rs (fn image_for). Keep the two in step. |
| 13 | """ |
| 14 | from PIL import Image, ImageDraw, ImageFilter, ImageFont |
| 15 | import os, sys |
| 16 | |
| 17 | OUT = os.path.join(os.path.dirname(__file__), "..", "public") |
| 18 | W, H = 1200, 630 |
| 19 | BG = (8, 9, 12) |
| 20 | GRID = (28, 37, 54) |
| 21 | BLUE = (45, 127, 249) |
| 22 | GREEN = (0, 229, 153) |
| 23 | TEXT = (241, 245, 249) |
| 24 | MUTED = (148, 163, 184) |
| 25 | DIM = (100, 116, 139) |
| 26 | |
| 27 | CARDS = [ |
| 28 | # file, kicker, claim (two lines max), sub line, address |
| 29 | ("og.png", "AienOS", |
| 30 | "Persistent machine intelligence\non a machine you own", |
| 31 | "Search turned into verified understanding. Every claim carries a public receipt.", |
| 32 | "www.aienos.com"), |
| 33 | ("og-machine.png", "THE MACHINE", |
| 34 | "Five real machines,\none verified loop", |
| 35 | "A Spark, an iMac, a Pi 5, a QEMU lab and a rig. Speeds stand beside the physical ceiling only.", |
| 36 | "www.aienos.com/machine/"), |
| 37 | ("og-now.png", "NOW", |
| 38 | "What every agent\nis doing right now", |
| 39 | "The live coordination ledger: open work, settled work with evidence, decisions waiting on the operator.", |
| 40 | "www.aienos.com/now/"), |
| 41 | ("og-turing.png", "THE TURING", |
| 42 | "A unit of verified\nexplanatory gain", |
| 43 | "Net held-out explanatory compression: one operational component of machine understanding.", |
| 44 | "www.aienos.com/turing/"), |
| 45 | ("og-research.png", "AIEN RESEARCH", |
| 46 | "Preprints, experiments\nand public evidence", |
| 47 | "The Turing papers, the Crumb Doctrine, the Omega language, the doctrine. Not peer reviewed; receipts attached.", |
| 48 | "www.aienos.com/research/"), |
| 49 | ("og-evidence.png", "EVIDENCE", |
| 50 | "Receipts over claims", |
| 51 | "Every number on this site carries its environment, its gate, its date and a link to the record. Failures stay on the record.", |
| 52 | "www.aienos.com/evidence/"), |
| 53 | ("og-blog.png", "BLOG", |
| 54 | "Research notes\nfrom the build", |
| 55 | "What shipped, what the evidence says, and what remains an open question.", |
| 56 | "www.aienos.com/blog/"), |
| 57 | ("og-discovery.png", "SCIENTIFIC DISCOVERY", |
| 58 | "The machine is never\ngiven the named answer", |
| 59 | "Physics Zero, Dirac, Zeta and supersymmetry as examinations of representation discovery.", |
| 60 | "www.aienos.com/discovery/"), |
| 61 | ("og-philosophy.png", "PHILOSOPHY", |
| 62 | "Position, not evidence", |
| 63 | "The Stapleton Doctrine and the Post-LLM Case: the stance behind the machine, argued in the open.", |
| 64 | "www.aienos.com/philosophy/"), |
| 65 | ("og-experiments.png", "EXPERIMENTS", |
| 66 | "Every experiment,\nfailures included", |
| 67 | "The research ladder rendered from one canonical status source, verdicts and limits attached.", |
| 68 | "www.aienos.com/experiments/"), |
| 69 | ("og-still-building.png", "#STILLBUILDING", |
| 70 | "If you built it with AI,\nyou built it", |
| 71 | "The measured stigma against people who use AI, the concerns that are real, and how to show your work.", |
| 72 | "www.aienos.com/still-building/"), |
| 73 | ] |
| 74 | |
| 75 | FONT_DIRS = ["/System/Library/Fonts/Supplemental", "/System/Library/Fonts", |
| 76 | "/usr/share/fonts/truetype/dejavu", "/usr/share/fonts/truetype/liberation"] |
| 77 | def font(names, size): |
| 78 | # Names in preference order: Arial and Menlo on macOS; on Linux, Liberation |
| 79 | # Sans (Arial's metrics) and DejaVu Sans Mono (Menlo's source), so a card |
| 80 | # drawn on either machine keeps the same line breaks and badge widths. |
| 81 | for n in names: |
| 82 | for d in FONT_DIRS: |
| 83 | p = os.path.join(d, n) |
| 84 | if os.path.exists(p): |
| 85 | return ImageFont.truetype(p, size) |
| 86 | return ImageFont.load_default(size) |
| 87 | |
| 88 | BOLD = ["Arial Bold.ttf", "LiberationSans-Bold.ttf", "DejaVuSans-Bold.ttf"] |
| 89 | REG = ["Arial.ttf", "LiberationSans-Regular.ttf", "DejaVuSans.ttf"] |
| 90 | MONO = ["Menlo.ttc", "DejaVuSansMono.ttf", "LiberationMono-Regular.ttf"] |
| 91 | |
| 92 | def glow(base, xy, r, color, alpha): |
| 93 | layer = Image.new("RGBA", base.size, (0, 0, 0, 0)) |
| 94 | d = ImageDraw.Draw(layer) |
| 95 | x, y = xy |
| 96 | d.ellipse((x - r, y - r, x + r, y + r), fill=color + (alpha,)) |
| 97 | layer = layer.filter(ImageFilter.GaussianBlur(r * 0.6)) |
| 98 | base.alpha_composite(layer) |
| 99 | |
| 100 | def wrap(draw, text, f, width): |
| 101 | lines = [] |
| 102 | for para in text.split("\n"): |
| 103 | words, cur = para.split(), "" |
| 104 | for w in words: |
| 105 | t = (cur + " " + w).strip() |
| 106 | if draw.textlength(t, font=f) <= width: |
| 107 | cur = t |
| 108 | else: |
| 109 | lines.append(cur); cur = w |
| 110 | lines.append(cur) |
| 111 | return lines |
| 112 | |
| 113 | def card(file, kicker, claim, sub, address): |
| 114 | im = Image.new("RGBA", (W, H), BG + (255,)) |
| 115 | d = ImageDraw.Draw(im) |
| 116 | for x in range(0, W, 60): |
| 117 | d.line((x, 0, x, H), fill=GRID + (40,), width=1) |
| 118 | for y in range(0, H, 60): |
| 119 | d.line((0, y, W, y), fill=GRID + (40,), width=1) |
| 120 | glow(im, (1040, 120), 300, BLUE, 70) |
| 121 | glow(im, (160, 600), 260, GREEN, 45) |
| 122 | d = ImageDraw.Draw(im) |
| 123 | # Brand mark: a small bracket in a blue box, like the site header. |
| 124 | d.rounded_rectangle((80, 72, 134, 126), radius=8, outline=BLUE, width=2, fill=(14, 18, 25, 255)) |
| 125 | d.line((96, 112, 112, 99, 96, 86), fill=GREEN, width=3) |
| 126 | d.line((112, 112, 122, 112), fill=GREEN, width=3) |
| 127 | fk = font(BOLD, 28) |
| 128 | d.text((152, 80), kicker, font=fk, fill=TEXT) |
| 129 | fm = font(MONO, 22) |
| 130 | aw = d.textlength(address, font=fm) |
| 131 | d.text((W - 80 - aw, 86), address, font=fm, fill=DIM) |
| 132 | fc = font(BOLD, 64) |
| 133 | lines = wrap(d, claim, fc, 1040) |
| 134 | y = 200 |
| 135 | for ln in lines[:3]: |
| 136 | d.text((80, y), ln, font=fc, fill=TEXT) |
| 137 | y += 74 |
| 138 | fs = font(REG, 28) |
| 139 | y += 18 |
| 140 | for ln in wrap(d, sub, fs, 1000)[:2]: |
| 141 | d.text((80, y), ln, font=fs, fill=MUTED) |
| 142 | y += 38 |
| 143 | # Badges along the bottom. |
| 144 | bx = 80 |
| 145 | for label, col in (("Open source, Apache-2.0", GREEN), ("Alpha testing", (245, 166, 35)), ("Receipts over claims", BLUE)): |
| 146 | tw = d.textlength(label, font=fm) |
| 147 | d.rounded_rectangle((bx, 518, bx + tw + 30, 558), radius=6, outline=col, width=1, fill=(14, 18, 25, 255)) |
| 148 | d.text((bx + 15, 526), label, font=fm, fill=col) |
| 149 | bx += tw + 46 |
| 150 | im.convert("RGB").save(os.path.join(OUT, file), optimize=True) |
| 151 | print("wrote", file) |
| 152 | |
| 153 | if __name__ == "__main__": |
| 154 | for c in CARDS: |
| 155 | card(*c) |
| 156 | |
| 157 | def logo(): |
| 158 | """A 512 x 512 mark for structured data (Organization.logo wants a raster).""" |
| 159 | s = 512 |
| 160 | im = Image.new("RGBA", (s, s), BG + (255,)) |
| 161 | glow(im, (420, 90), 160, BLUE, 80) |
| 162 | glow(im, (90, 430), 140, GREEN, 50) |
| 163 | d = ImageDraw.Draw(im) |
| 164 | d.rounded_rectangle((96, 96, 416, 416), radius=48, outline=BLUE, width=10, fill=(14, 18, 25, 255)) |
| 165 | d.line((176, 328, 268, 256, 176, 184), fill=GREEN, width=22, joint="curve") |
| 166 | d.line((268, 328, 336, 328), fill=GREEN, width=22) |
| 167 | im.convert("RGB").save(os.path.join(OUT, "logo.png"), optimize=True) |
| 168 | print("wrote logo.png") |
| 169 | |
| 170 | if __name__ == "__main__": |
| 171 | logo() |