From c328d03fa0d22ea7cedf0e23e55928c5a229740d Mon Sep 17 00:00:00 2001 From: martbost Date: Thu, 8 Oct 2026 14:43:18 -0500 Subject: [PATCH] tools: niche hero generator (kie.ai prompts per niche) + packer, so sets can be regenerated or extended Co-Authored-By: Claude Fable 5.1 --- tools/niche-heroes-pack.py | 35 +++++++++++++++++++++ tools/niche-heroes.py | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 tools/niche-heroes-pack.py create mode 100644 tools/niche-heroes.py diff --git a/tools/niche-heroes-pack.py b/tools/niche-heroes-pack.py new file mode 100644 index 0000000..59affce --- /dev/null +++ b/tools/niche-heroes-pack.py @@ -0,0 +1,35 @@ +# Pack the niche hero sets: originals (-1) + generated (-2..-4, gaming -1..-4) -> optimized JPEGs in the LinkSpin repo, +# plus a contact sheet for review. +from PIL import Image, ImageDraw +import os, pathlib +HERE = pathlib.Path(__file__).parent; OUT = pathlib.Path('D:/Projects/HighRisk/linkspin/site/public/niches'); OUT.mkdir(exist_ok=True) +NICHES = ['health-wellness', 'make-money-online', 'personal-finance', 'coaching-consulting', 'self-improvement', 'relationships', 'gaming'] +rows = [] +for n in NICHES: + files = [] + if n != 'gaming': files.append(HERE / f'{n}.jpg') + for i in range(1, 5): + p = HERE / 'gen' / f'{n}-{i}.png' + if p.exists(): files.append(p) + files = files[:4] + row = [] + for i, src in enumerate(files): + im = Image.open(src).convert('RGB') + if im.size != (1536, 1024): im = im.resize((1536, 1024), Image.LANCZOS) + dst = OUT / f'{n}-{i + 1}.jpg' + im.save(dst, 'JPEG', quality=82, optimize=True, progressive=True) + row.append((dst.name, im.copy(), os.path.getsize(dst) // 1024)) + rows.append((n, row)) +# contact sheet: 4 across, one row per niche +TW, TH, PAD, LAB = 384, 256, 10, 26 +sheet = Image.new('RGB', (4 * (TW + PAD) + PAD, len(rows) * (TH + LAB + PAD) + PAD), (18, 18, 22)); d = ImageDraw.Draw(sheet) +for r, (n, row) in enumerate(rows): + y = PAD + r * (TH + LAB + PAD) + d.text((PAD, y + 4), n.upper(), fill=(230, 230, 235)) + for c, (name, im, kb) in enumerate(row): + x = PAD + c * (TW + PAD) + sheet.paste(im.resize((TW, TH), Image.LANCZOS), (x, y + LAB)) + d.text((x + 6, y + LAB + TH - 18), f'{name} {kb}KB', fill=(255, 255, 255)) +sheet.save(HERE / 'contact-sheet.jpg', 'JPEG', quality=80) +for n, row in rows: print(n, [(a, c) for a, _, c in row]) +print('total KB', sum(os.path.getsize(OUT / f) for f in os.listdir(OUT)) // 1024) diff --git a/tools/niche-heroes.py b/tools/niche-heroes.py new file mode 100644 index 0000000..f04cecc --- /dev/null +++ b/tools/niche-heroes.py @@ -0,0 +1,63 @@ +# Niche hero sets for LinkSpin pages (Marty 2026-10-08): three more photographic heroes per existing niche + four for a +# new Gaming niche. kie.ai nano-banana-pro via the BannerKitAI generator, textless, 1536x1024 like the originals. +import os, subprocess, sys, pathlib, time +HERE = pathlib.Path(__file__).parent; OUT = HERE / 'gen'; OUT.mkdir(exist_ok=True) +GEN = r'D:\Projects\BannerKitAI\render\scripts\generate-banner-image.py' +key = open(r'C:\Users\Marty\.kie-key').read().strip() +env = dict(os.environ, KIE_API_KEY=key, PYTHONIOENCODING='utf-8') +STYLE = (' Editorial photograph shot on a full-frame camera with a 35mm lens, shallow depth of field, natural or practical light, ' + 'photorealistic, high-end magazine quality, muted cinematic color grade, no illustration, no cartoon, no vector look. ' + 'Absolutely no text, no words, no letters, no logos, no watermarks anywhere, screens show only abstract shapes or soft colour. ' + 'Full-bleed: the camera is inside the scene and the scene extends past all four edges, no frame, no border, no mockup.') +SHOTS = { + 'health-wellness': [ + 'A woman in her thirties doing a morning yoga stretch on a weathered wooden deck above a calm sea, soft sunrise haze, a rolled mat and a glass of water beside her.', + 'A bright kitchen counter with a fresh smoothie bowl topped with berries and seeds, a glass of green juice, sliced citrus, and morning light through a window.', + 'A runner crouched to tie a shoe on a forest trail at sunrise, light rays through the trees, dew on the grass, water bottle on a rock.', + ], + 'make-money-online': [ + 'A young man working on a laptop at a sunlit cafe table, flat white beside him, phone face up showing a soft glowing abstract notification, city street blurred behind the window.', + 'A cosy home office at night, two monitors glowing with abstract colourful charts, warm desk lamp, headphones on a stand, a cat asleep on the chair arm.', + 'A laptop open on a hammock between palm trees at a tropical beach, turquoise water, a coconut with a straw, late afternoon light.', + ], + 'personal-finance': [ + 'Close-up of hands writing in a leather notebook on a dark walnut desk, a calculator, a small stack of coins, a cup of black coffee, warm side light.', + 'A glass jar filled with coins with a tiny green seedling sprouting from the top, on a rustic wooden table by a window, golden hour light.', + 'A couple at a kitchen table in the morning reviewing papers together, laptop open, two mugs, calm and confident mood, soft daylight.', + ], + 'coaching-consulting': [ + 'A confident coach in a blazer speaking to a small group of six adults seated in a bright industrial loft with exposed brick and large windows.', + 'Two people in a one-on-one conversation across a small wooden table, an open notebook and a tablet between them, a plant and window light behind.', + 'A presenter gesturing at a whiteboard covered in abstract diagrams, arrows and shapes only, in a modern meeting room, listeners slightly out of focus in the foreground.', + ], + 'self-improvement': [ + 'A person journaling in a notebook by a tall window at dawn, blanket over the shoulders, a mug steaming, the city soft and blue outside.', + 'A hiker standing at a rocky summit at golden hour looking over layered mountain ridges, backpack on, wind in the jacket.', + 'A stack of hardcover books with reading glasses on top, a cup of tea and a small lamp, warm evening light on a linen tablecloth.', + ], + 'relationships': [ + 'A couple walking hand in hand along the shoreline at sunset, waves washing over their feet, warm orange and pink sky.', + 'Two close friends laughing over coffee at a corner table in a warm cafe, afternoon light, croissants on a plate.', + 'A couple cooking together in a warm kitchen, chopping vegetables and smiling, steam rising from a pan, pendant lights glowing.', + ], + 'gaming': [ + 'A gaming desk at night with an RGB-lit mechanical keyboard, a headset on a stand, and an ultrawide monitor glowing with abstract colourful game visuals, purple and teal light.', + 'Hands holding a handheld game console on a couch in a dim living room lit by neon strip lights, a bowl of popcorn and an energy drink on the table.', + 'An esports arena stage with dramatic blue and magenta lighting, a crowd silhouetted in the foreground, haze in the air, large screens showing abstract light.', + 'A row of glowing retro arcade cabinets in a dim arcade hall, colourful screens showing only abstract shapes, reflections on a polished floor.', + ], +} +only = sys.argv[1:] # optional: niche keys to (re)generate +for niche, prompts in SHOTS.items(): + if only and niche not in only: continue + start = 2 if niche != 'gaming' else 1 + for i, p in enumerate(prompts): + out = OUT / f'{niche}-{start + i}.png' + if out.exists() and out.stat().st_size > 50000: print('skip', out.name); continue + for attempt in range(2): + r = subprocess.run([sys.executable, GEN, '--prompt', p + STYLE, '--width', '1536', '--height', '1024', '--no-text', '--filename', str(out)], env=env, capture_output=True, text=True) + ok = out.exists() and out.stat().st_size > 50000 + print(('ok ' if ok else 'FAIL') + ' ' + out.name, (r.stdout + r.stderr).strip().splitlines()[-1][:160] if (r.stdout + r.stderr).strip() else '', flush=True) + if ok: break + time.sleep(5) +print('DONE')