diff --git a/README.md b/README.md index eec2f99..a81047e 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,8 @@ holds no application code. | `profile/README.md` | The organisation's public profile page. | | `brand/BRAND.md` | **The brand book** — wordmark, logo, palette, the visual world and the system that generates it. | | `brand/logo/` | Logo and mark SVGs, palette variants, and the 512×512 avatar. | -| `brand/plates/` | The chosen generated plate per format, and kept plates no surface cuts from — `readme-filter.png` is the fluted fan that was the README banner until 6 November 2026. | +| `brand/plates/` | The approved plate behind each surface, drawn at that surface's own size, plus kept plates nothing ships from — `readme-filter.png`, the fluted fan that was the README banner until 6 November 2026, and `wide.png`. Both are kept on purpose; nothing cutting from a plate is not a reason to drop it. | | `brand/assets/` | Every shipped surface: social previews, banners, square, story, print. | -| `brand/tools/` | `prompts.json`, `gen_texture.py`, `surfaces.json`, `surfaces.py`. | | `SECURITY.md` | How to report a vulnerability. Applies to every repository. | | `CONTRIBUTING.md` | Conventions, the gates, and the decisions that are deliberate. | | `CODE_OF_CONDUCT.md` | How we deal with each other. | diff --git a/brand/tools/contact_sheet.mjs b/brand/tools/contact_sheet.mjs deleted file mode 100644 index 6fa792a..0000000 --- a/brand/tools/contact_sheet.mjs +++ /dev/null @@ -1,65 +0,0 @@ -// Render a contact sheet of every shipped surface, so a round can be judged at -// a glance instead of one file at a time. -// -// It resolves puppeteer-core from the PRODUCT repo, so run it from there: -// -// cd -// cp ./sheet.tmp.mjs -// CHROMIUM_PATH=... node ./sheet.tmp.mjs [theme] -// rm ./sheet.tmp.mjs -// -// Writes /contact-sheet<-theme>.png. -import puppeteer from 'puppeteer-core' -import { readFileSync, writeFileSync, readdirSync } from 'node:fs' -import { join, resolve, extname } from 'node:path' - -const BRAND = resolve(process.argv[2]) -const THEME = process.argv[3] || 'default' -const suffix = THEME === 'default' ? '' : `-${THEME}` - -const cfg = JSON.parse(readFileSync(join(BRAND, 'tools', 'surfaces.json'), 'utf8')).surfaces -const assets = join(BRAND, 'assets') -const have = new Set(readdirSync(assets)) - -const mime = e => (e === '.png' ? 'image/png' : 'image/jpeg') -const dataUri = f => `data:${mime(extname(f))};base64,` + readFileSync(join(assets, f)).toString('base64') - -const cards = Object.entries(cfg).map(([name, s]) => { - const file = `${name}${suffix}.${s.format}` - if (!have.has(file)) return '' - const ratio = (s.w / s.h).toFixed(2) - return `
-
- -
-
-
${name}
-
${s.w}×${s.h} · ${ratio}:1 · ${s.format.toUpperCase()}
-
${s.use}
-
-
` -}).filter(Boolean).join('') - -const html = ` - - - -
Kaffeelisten — brand surfaces
-
${THEME} theme · ${Object.keys(cfg).length} surfaces · every file rebuilt from pixels only
-
-
${cards}
-` - -const b = await puppeteer.launch({ - executablePath: process.env.CHROMIUM_PATH, headless: 'new', - args: ['--no-sandbox', '--force-color-profile=srgb'], -}) -const p = await b.newPage() -await p.setViewport({ width: 1600, height: 1200, deviceScaleFactor: 1 }) -await p.setContent(html, { waitUntil: 'networkidle0' }) -await p.evaluate(() => document.fonts.ready) -const buf = await p.screenshot({ type: 'png', fullPage: true }) -const out = join(BRAND, `contact-sheet${suffix}.png`) -writeFileSync(out, buf) -console.log(`${out} ${(buf.length / 1024).toFixed(0)} KB`) -await b.close() diff --git a/brand/tools/gen_texture.py b/brand/tools/gen_texture.py deleted file mode 100644 index 6bf9b92..0000000 --- a/brand/tools/gen_texture.py +++ /dev/null @@ -1,100 +0,0 @@ -"""Generate Kaffeelisten texture plates with gpt-image-2.5-sunburst. - - python -I gen_texture.py [theme] [n] [round] - - format : banner | square | portrait (prompts.json → formats) - theme : default | halloween | christmas | easter | wald - n : how many candidates (default 3) - round : label for this batch (default r1) - -Writes out/---.png, each rebuilt from pixels only so -no C2PA, EXIF or text chunk ever ships. - -The model draws the WORLD only — paper, folds, stains, light. It never draws the -logo and never draws lettering; those are composited afterwards by compose.mjs -from the real SVG and real Inter, so brand fidelity does not depend on a model. - -Needs OPENAI_API_KEY (workspace .env.local at the umbrella root, or dotPrivate/.env) -and curl. The key is passed on stdin, never as an argv entry. -""" -import base64 -import json -import os -import pathlib -import subprocess -import sys - -from PIL import Image - -HERE = pathlib.Path(__file__).resolve().parent -CFG = json.loads((HERE / "prompts.json").read_text(encoding="utf-8")) -LOGO_REF = HERE.parent / "logo" / "avatar-512.png" -OUT = HERE.parent / "out" - - -def build_prompt(fmt: str, theme: str) -> str: - f = CFG["formats"][fmt] - parts = [] - # Lettering leads: a long "no text" tail at the end suppresses it entirely. - if f.get("lettered", True): - key = "lettering_stacked" if f.get("stacked") else "lettering" - if CFG.get(key): - parts.append(CFG[key]) - parts += [CFG["base"], f["composition"], CFG["palette_rule"]] - if CFG["themes"].get(theme): - parts.append(CFG["themes"][theme]) - parts.append( - "The FIRST reference image is the brand logo: match its exact amber and its " - "warm off-white, but do NOT redraw the logo itself." - ) - parts.append(CFG["negative"]) - return " ".join(p for p in parts if p) - - -def strip_metadata(path: pathlib.Path) -> None: - im = Image.open(path) - clean = Image.new("RGB", im.size) - clean.putdata(list(im.convert("RGB").getdata())) - clean.save(path, optimize=True) - - -def main() -> int: - fmt = sys.argv[1] if len(sys.argv) > 1 else "banner" - theme = sys.argv[2] if len(sys.argv) > 2 else "default" - n = sys.argv[3] if len(sys.argv) > 3 else "3" - rnd = sys.argv[4] if len(sys.argv) > 4 else "r1" - - if fmt not in CFG["formats"]: - sys.exit(f"unknown format {fmt!r}; have {', '.join(CFG['formats'])}") - if theme not in CFG["themes"]: - sys.exit(f"unknown theme {theme!r}; have {', '.join(CFG['themes'])}") - if not LOGO_REF.is_file(): - sys.exit(f"missing logo reference: {LOGO_REF}") - - cmd = [ - "curl", "-sS", "-K", "-", "https://api.openai.com/v1/images/edits", - "-F", f"model={CFG['model']}", - "-F", f"prompt={build_prompt(fmt, theme)}", - "-F", f"size={CFG['formats'][fmt]['size']}", - "-F", "quality=high", "-F", f"n={n}", - "-F", f"image[]=@{LOGO_REF}", - ] - auth = 'header = "Authorization: Bearer ' + os.environ["OPENAI_API_KEY"] + '"' + chr(10) - res = subprocess.run(cmd, input=auth, capture_output=True, text=True, timeout=900) - if res.returncode != 0: - sys.exit(f"curl failed: {res.stderr[:400]}") - data = json.loads(res.stdout) - if "error" in data: - sys.exit(f"api: {data['error'].get('message')}") - - OUT.mkdir(exist_ok=True) - for i, item in enumerate(data["data"], 1): - p = OUT / f"{fmt}-{theme}-{rnd}-{i}.png" - p.write_bytes(base64.b64decode(item["b64_json"])) - strip_metadata(p) - print(f"{p.name} {p.stat().st_size // 1024} KB") - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/brand/tools/prompts.json b/brand/tools/prompts.json deleted file mode 100644 index 121d51f..0000000 --- a/brand/tools/prompts.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "model": "gpt-image-2.5-sunburst", - "_note": "The reusable prompt system. Each entry in 'formats' is a DISTINCT composition with its own creative direction, not one template resized - that is what separates a strong asset from a weak one. The model generates the whole poster, lettering included, so the type sits in the paper world and carries its grain. Add a theme to get a seasonal set; nothing else needs editing.", - "palette": { - "paper": "#FAFAF9", - "ink": "#1C1917", - "amber": "#D97706", - "amber_light": "#F59E0B", - "stone": "#57534E" - }, - "base": "Flat graphic cut-paper collage, designed as a poster, NOT a photograph. Every element is cut or torn from textured paper and laid flat: clean geometric planes, hard fold lines shown as straight edges between two tones, deliberately torn edges with a soft deckled fibre lip, visible paper grain inside every shape, crisp cut edges. Screen-printed risograph feel with limited flat inks. The composition is DENSE and LAYERED, with real depth from overlapping planes and a soft contact shadow where one sheet sits on another - rich and balanced, never sparse, never a large empty field.", - "palette_rule": "Strictly three flat inks: warm off-white paper as the ground, deep warm near-black, and exactly one saturated warm amber as the single accent, used boldly on large shapes. No other hue anywhere. No blue, no green, no pink, no teal, no pastel yellow.", - "negative": "NOT a photograph: no photographic realism, no depth of field, no studio lighting, no cast shadows, no 3D rendering, no origami cranes or animals, no desk scene, no props, no plants, no leaves, no flowers, no hands, no people. Apart from those two lines of type, add no other words, no numbers, no labels, no signature, no watermark, no logo. Do not misspell anything. No gradients, no vignette, no sepia.", - "formats": { - "banner": { - "size": "1536x1024", - "composition": "A torn vertical edge splits the frame: calm paper on the left carrying the lettering, and on the right a dense amber field with the cup drawn as a white cut-paper outline, a small cut-paper note bearing the cup mark, a printed coffee ring, scattered beans and layered kraft planes receding into a dark plane at the corner. 2:1 and 1.9:1 crops are taken from the vertical centre, so keep the very top and bottom edges quieter than the middle.", - "lettered": true - }, - "square": { - "size": "1024x1024", - "composition": "A centred poster: the cup is the hero, large, drawn as a white cut-paper outline on a bold amber plane filling the lower two thirds, with layered kraft and dark planes radiating out behind it and a printed ring overlapping the lower edge. The stacked two-line name sits in the upper third on clean paper. Balanced, iconic, dense. Used at 1:1 with no crop.", - "lettered": true, - "stacked": true - }, - "portrait": { - "size": "1024x1536", - "composition": "A tall stack: the stacked two-line name on paper at the top, a wide torn amber band across the middle carrying the cup as a large white cut-paper outline, and beneath it layered kraft and dark planes with a printed ring and a small note overlapping them. The eye travels straight down, dense all the way to the bottom edge. A 9:16 crop trims the sides, so keep the lettering and the focal elements inside the central three quarters of the width.", - "lettered": true, - "stacked": true - }, - "ultrawide": { - "size": "1536x1024", - "lettered": true, - "composition": "A frieze: a continuous horizontal rhythm of cut-paper elements marching across the strip - the lettering at the left, then a torn amber plane, the cup as a white outline, a printed ring, a small note, a trio of beans, and a dark plane closing the right end. Each element overlaps its neighbour so the strip reads as one dense band with no gaps. A 5.9:1 crop is taken from a shallow strip at the exact vertical centre, so EVERYTHING must sit inside the middle quarter of the height, lettering included and scaled down to fit it." - }, - "wide3": { - "size": "1536x1024", - "lettered": true, - "composition": "A long panoramic counter: layered paper planes running the FULL width in an unbroken horizontal rhythm, a torn amber sweep crossing behind, the cup as a large white cut-paper outline just right of centre, a printed ring and scattered beans to its right, a dark angular plane anchoring the far right. The lettering sits on the left, over paper, with the layers continuing behind it. A 3:1 crop is taken from the middle half of the height, so every part of that centre band must be occupied - no empty stretches anywhere along it." - }, - "xheader": { - "size": "1536x1024", - "lettered": true, - "composition": "Bold and graphic, the opposite of a panorama: a huge amber field occupies the right two thirds as a single confident plane, the cup reversed out of it as a clean white cut-paper outline at generous scale, a dark angular plane cutting in from the lower left, and a small printed ring overlapping the join. The lettering sits on the remaining paper at the left. Few elements, large, high contrast. A 3:1 crop is taken from the middle half of the height." - }, - "emailheader": { - "size": "1536x1024", - "lettered": true, - "composition": "Editorial and typographic: mostly warm paper, with ONE strong amber torn diagonal running from the lower left to the upper right behind the type, a small stack of cut-paper notes with the cup mark on the top one, and a printed ring sitting half on the paper and half on the amber. The lettering is the hero and sits large across the left two thirds. Quiet and confident, but still layered. A 3:1 crop is taken from the middle half of the height." - } - }, - "themes": { - "default": "", - "halloween": "One cut-paper crescent and one angular bat silhouette sit among the planes; the accent deepens toward burnt orange. Still three flat inks.", - "christmas": "One folded paper star and one narrow cut snowflake sit among the planes; the accent warms toward gold. Still three flat inks.", - "easter": "One cut-paper egg shape and one torn arc sit among the planes. Still three flat inks.", - "wald": "A row of angular cut-paper pine silhouettes runs along the lower edge. Still three flat inks." - }, - "copy": { - "wordmark": "Kaffeelisten", - "tagline": "Die Kaffeeliste - ohne Papier.", - "url": "kaffeelisten.de" - }, - "lettering": "THIS IS A TYPOGRAPHIC POSTER. The single word \"Kaffeelisten\" is the main subject, large and clearly readable in the calm area. Spell it EXACTLY K-a-f-f-e-e-l-i-s-t-e-n as one unbroken word with no space and no hyphen. SET IT IN TWO COLOURS WITHIN THE ONE WORD: the first six letters \"Kaffee\" in the deep warm near-black ink, and the last six letters \"listen\" in the saturated warm amber. The colour change happens mid-word with no gap. A clean modern geometric sans-serif, heavy weight, tight letter-spacing, printed flat on the paper so it carries the paper's grain. Directly beneath it, much smaller and lighter in near-black, the line \"Die Kaffeeliste - ohne Papier.\" Letterforms crisp, even and correctly formed.", - "lettering_stacked": "THIS IS A TYPOGRAPHIC POSTER. The name is set on TWO LINES, stacked and left-aligned, reading \"Kaffee\" on the first line and \"listen\" on the second line - together they spell the single word Kaffeelisten. \"Kaffee\" is in the deep warm near-black ink and \"listen\" directly beneath it is in the saturated warm amber. Tight line spacing so the two lines read as one block. A clean modern geometric sans-serif, heavy weight, tight letter-spacing, printed flat on the paper so it carries the paper's grain. Beneath the block, much smaller and lighter in near-black, the line \"Die Kaffeeliste - ohne Papier.\" Letterforms crisp, even and correctly formed. Spell both words exactly: K-a-f-f-e-e and l-i-s-t-e-n." -} diff --git a/brand/tools/surfaces.json b/brand/tools/surfaces.json deleted file mode 100644 index a7ec01f..0000000 --- a/brand/tools/surfaces.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "_note": "Every surface the brand ships to, and which generated plate it is cut from. 'plate' names a format in prompts.json. 'mode' is 'cover' (fill the frame, trim the rest) or 'fit' (scale the whole composition down and pad with the plate's own paper). Use 'cover' by default. Use 'fit' only when the surface ratio is CLOSE to the plate's, where the padding reads as a margin - at an extreme gap it shrinks the art to a stamp, and the answer there is a new generation brief, not a different crop. 'focus' is the vertical anchor of a cover crop, 0 top, 1 bottom.", - "surfaces": { - "github-social": { - "w": 1280, - "h": 640, - "plate": "banner", - "format": "jpg", - "focus": 0.5, - "use": "GitHub repository social preview. Settings, Social preview. Must stay under 1 MB." - }, - "og": { - "w": 1200, - "h": 630, - "plate": "banner", - "format": "jpg", - "focus": 0.5, - "use": "Open Graph and Twitter card. Link previews in chat, Slack, search." - }, - "readme-banner": { - "w": 1536, - "h": 512, - "plate": "wide3", - "format": "jpg", - "focus": 0.5, - "use": "The wide strip at the top of a README. Its own panoramic composition, layered edge to edge.", - "mode": "cover" - }, - "linkedin-banner": { - "w": 1128, - "h": 191, - "plate": "ultrawide", - "format": "jpg", - "focus": 0.5, - "use": "LinkedIn company page cover. Cut from the ultrawide frieze, whose elements march across a shallow centre strip so a 5.9:1 crop stays dense.", - "mode": "cover" - }, - "linkedin-post": { - "w": 1200, - "h": 627, - "plate": "banner", - "format": "jpg", - "focus": 0.5, - "use": "LinkedIn link post and single-image post." - }, - "x-header": { - "w": 1500, - "h": 500, - "plate": "xheader", - "format": "jpg", - "focus": 0.5, - "use": "X profile header. Its own bold composition: one large amber field, the cup reversed out, high contrast. Centre is safe, edges are overlaid by the UI.", - "mode": "cover" - }, - "instagram-square": { - "w": 1080, - "h": 1080, - "plate": "square", - "format": "jpg", - "focus": 0.5, - "use": "Square social post. Centred poster with the stacked two-line lockup and the cup as hero." - }, - "story": { - "w": 1080, - "h": 1920, - "plate": "portrait", - "format": "jpg", - "focus": 0.5, - "use": "Stories and reels cover. Cut from the portrait stack, briefed with side margins so the 9:16 crop never clips the name.", - "mode": "cover" - }, - "email-header": { - "w": 1200, - "h": 400, - "plate": "emailheader", - "format": "jpg", - "focus": 0.5, - "use": "Newsletter header. Its own editorial composition: type-led, one amber diagonal, a stack of notes.", - "mode": "cover" - }, - "print-a4-landscape": { - "w": 3508, - "h": 2480, - "plate": "banner", - "format": "png", - "focus": 0.5, - "use": "A4 at 300 dpi, for a poster by the machine or a one-pager cover. Upscaled from the plate, so check it at size before printing." - } - } -} diff --git a/brand/tools/surfaces.py b/brand/tools/surfaces.py deleted file mode 100644 index 3a7b4d0..0000000 --- a/brand/tools/surfaces.py +++ /dev/null @@ -1,113 +0,0 @@ -"""Cut every brand surface from the chosen plates. - - python -I surfaces.py [theme] - -Reads surfaces.json, takes each surface's source plate from plates/.png -(or plates/-.png), crops it to the surface's aspect around the -surface's focus, resizes, and writes assets/.. - -Every file is rebuilt from pixels only, so no C2PA, EXIF or text chunk ships. - -Choosing a plate is a human step: look at the candidates in out/, then copy the -one you want to plates/.png. Nothing here picks for you. -""" -import json -import pathlib -import sys - -from PIL import Image - -HERE = pathlib.Path(__file__).resolve().parent -BRAND = HERE.parent -CFG = json.loads((HERE / "surfaces.json").read_text(encoding="utf-8"))["surfaces"] -PLATES = BRAND / "plates" -ASSETS = BRAND / "assets" - -JPEG_LIMIT_KB = 1024 - - -def pixels_only(im: Image.Image) -> Image.Image: - clean = Image.new("RGB", im.size) - clean.putdata(list(im.convert("RGB").getdata())) - return clean - - -def paper(im: Image.Image) -> tuple: - """The plate's own paper tone, averaged from its four corners.""" - w, h = im.size - pts = [(2, 2), (w - 3, 2), (2, h - 3), (w - 3, h - 3)] - px = [im.getpixel(p) for p in pts] - return tuple(sum(c[i] for c in px) // len(px) for i in range(3)) - - -def crop_to(im: Image.Image, ratio: float, focus: float) -> Image.Image: - """Cover: fill the frame, trimming whatever does not fit.""" - w, h = im.size - if w / h > ratio: # too wide: trim the sides, keep centre - tw = int(round(h * ratio)) - left = (w - tw) // 2 - return im.crop((left, 0, left + tw, h)) - th = int(round(w / ratio)) # too tall: trim top/bottom around focus - top = int(round((h - th) * focus)) - top = max(0, min(h - th, top)) - return im.crop((0, top, w, top + th)) - - -def fit_to(im: Image.Image, w: int, h: int) -> Image.Image: - """Fit: keep the whole composition, pad with the plate's own paper. - - Used where the surface is a far more extreme ratio than anything the image - API can generate. Cropping to those shapes eats the artwork, so the band is - scaled down whole and the margins are filled with its paper tone, which - reads as a deliberate margin rather than a bad crop. - """ - scale = min(w / im.width, h / im.height) - inner = im.resize((max(1, int(im.width * scale)), max(1, int(im.height * scale))), Image.LANCZOS) - canvas = Image.new("RGB", (w, h), paper(im)) - canvas.paste(inner, ((w - inner.width) // 2, (h - inner.height) // 2)) - return canvas - - -def main() -> int: - theme = sys.argv[1] if len(sys.argv) > 1 else "default" - suffix = "" if theme == "default" else f"-{theme}" - ASSETS.mkdir(exist_ok=True) - - missing, written = [], 0 - for name, s in CFG.items(): - plate = PLATES / f"{s['plate']}{suffix}.png" - if not plate.is_file(): - missing.append(f"{name}: needs {plate.relative_to(BRAND)}") - continue - im = Image.open(plate).convert("RGB") - if s.get("mode", "cover") == "fit": - im = pixels_only(fit_to(im, s["w"], s["h"])) - else: - im = crop_to(im, s["w"] / s["h"], s.get("focus", 0.5)) - im = pixels_only(im.resize((s["w"], s["h"]), Image.LANCZOS)) - - out = ASSETS / f"{name}{suffix}.{s['format']}" - if s["format"] == "jpg": - q = 90 - while True: - im.save(out, "JPEG", quality=q, optimize=True, progressive=True, subsampling=0) - if out.stat().st_size // 1024 <= JPEG_LIMIT_KB or q <= 60: - break - q -= 6 - else: - im.save(out, optimize=True) - - kb = out.stat().st_size // 1024 - # Only the platform-capped surfaces care about the size; a print file is meant to be big. - flag = " OVER 1 MB" if kb > JPEG_LIMIT_KB and s["format"] == "jpg" else "" - print(f"{out.name:30} {s['w']:>5}x{s['h']:<5} {kb:5d} KB{flag}") - written += 1 - - for m in missing: - print(f"skipped {m}") - print(f"\n{written} surfaces written to {ASSETS.relative_to(BRAND.parent)}") - return 0 - - -if __name__ == "__main__": - raise SystemExit(main())