ed6febe0b8
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
98 lines
5.1 KiB
Python
98 lines
5.1 KiB
Python
# BixPay promo banners (2026-10-29): four text-only sizes for Promo tools > BixPay. No BIX logo (brand rules not confirmed),
|
|
# the "crypto Visa card" angle in the game-banner style: deep green, mint accent, Sora-like bold display text, a card motif
|
|
# drawn with shapes. Run: python tools/gen-bixpay-banners.py <outdir> then upload to Spaces game-banners/bixpay/.
|
|
# Copy rules: no income promises, the one fee line, no em dashes.
|
|
import sys, os
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
|
|
OUT = sys.argv[1] if len(sys.argv) > 1 else "D:/tmp/bixpay-banners"
|
|
os.makedirs(OUT, exist_ok=True)
|
|
GREEN = (4, 59, 47); DEEP = (3, 38, 31); MINT = (67, 232, 195); INK = (236, 248, 243); MUTED = (170, 205, 194); AMBER = (255, 178, 56)
|
|
FONTS = ["C:/Windows/Fonts/segoeuib.ttf", "C:/Windows/Fonts/arialbd.ttf"]
|
|
FONT_R = ["C:/Windows/Fonts/segoeui.ttf", "C:/Windows/Fonts/arial.ttf"]
|
|
def font(size, bold=True):
|
|
for p in (FONTS if bold else FONT_R):
|
|
if os.path.exists(p): return ImageFont.truetype(p, size)
|
|
return ImageFont.load_default()
|
|
|
|
def bg(w, h):
|
|
im = Image.new("RGB", (w, h), GREEN)
|
|
d = ImageDraw.Draw(im)
|
|
# soft diagonal band
|
|
for i in range(h):
|
|
t = i / max(1, h - 1)
|
|
c = tuple(int(GREEN[k] * (1 - t) + DEEP[k] * t) for k in range(3))
|
|
d.line([(0, i), (w, i)], fill=c)
|
|
return im
|
|
|
|
def card(d, x, y, w, h):
|
|
# a plain card shape: rounded rectangle, a chip, a stripe. No brand marks.
|
|
d.rounded_rectangle((x, y, x + w, y + h), radius=int(h * 0.12), fill=MINT)
|
|
d.rounded_rectangle((x + w * 0.08, y + h * 0.32, x + w * 0.26, y + h * 0.56), radius=int(h * 0.05), fill=(214, 182, 90))
|
|
d.rounded_rectangle((x + w * 0.08, y + h * 0.70, x + w * 0.62, y + h * 0.78), radius=int(h * 0.03), fill=(6, 60, 48))
|
|
d.ellipse((x + w * 0.70, y + h * 0.62, x + w * 0.84, y + h * 0.86), fill=(6, 60, 48))
|
|
d.ellipse((x + w * 0.79, y + h * 0.62, x + w * 0.93, y + h * 0.86), outline=(6, 60, 48), width=max(2, int(h * 0.03)))
|
|
|
|
def text_w(d, s, f):
|
|
b = d.textbbox((0, 0), s, font=f); return b[2] - b[0], b[3] - b[1]
|
|
|
|
def fit(d, s, maxw, start, bold=True, floor=10):
|
|
sz = start
|
|
while sz > floor:
|
|
f = font(sz, bold)
|
|
if text_w(d, s, f)[0] <= maxw: return f
|
|
sz -= 1
|
|
return font(floor, bold)
|
|
|
|
def pill(d, x, y, s, f, pad=10):
|
|
# the text's bbox offsets (Segoe sits a few px below the origin) are subtracted so the label is centred in the pill
|
|
b = d.textbbox((0, 0), s, font=f); tw, th = b[2] - b[0], b[3] - b[1]
|
|
d.rounded_rectangle((x, y, x + tw + pad * 2, y + th + pad * 2), radius=(th + pad * 2) // 2, fill=MINT)
|
|
d.text((x + pad - b[0], y + pad - b[1]), s, font=f, fill=(4, 30, 24))
|
|
return tw + pad * 2
|
|
def pill_size(d, s, f, pad=10):
|
|
b = d.textbbox((0, 0), s, font=f); return b[2] - b[0] + pad * 2, b[3] - b[1] + pad * 2
|
|
|
|
def leaderboard(w, h): # 728x90, 468x60
|
|
im = bg(w, h); d = ImageDraw.Draw(im)
|
|
ch = int(h * 0.62); cw = int(ch * 1.58); cx = int(h * 0.18); cy = (h - ch) // 2
|
|
card(d, cx, cy, cw, ch)
|
|
x = cx + cw + int(h * 0.22)
|
|
head = "A Visa card for your crypto"
|
|
f1 = fit(d, head, w * 0.52, int(h * 0.30)); d.text((x, int(h * 0.12)), head, font=f1, fill=INK)
|
|
sub = "Spend POL anywhere Visa is accepted. 3% per purchase, no load fee."
|
|
f2 = fit(d, sub, w * 0.55, int(h * 0.17), bold=False); d.text((x, int(h * 0.56)), sub, font=f2, fill=MUTED)
|
|
f3 = font(int(h * 0.19)); s = "Get the card"; pad = int(h * 0.09)
|
|
pw, ph = pill_size(d, s, f3, pad); pill(d, w - pw - int(h * 0.18), (h - ph) // 2, s, f3, pad=pad)
|
|
return im
|
|
|
|
def rectangle(w, h): # 300x250
|
|
im = bg(w, h); d = ImageDraw.Draw(im)
|
|
f0 = font(12); d.text((18, 16), "CRYPTO VISA CARD", font=f0, fill=MINT)
|
|
cw = 118; ch = 74; card(d, w - cw - 18, 14, cw, ch)
|
|
head = "Spend your POL\nanywhere"
|
|
f1 = font(26); d.multiline_text((18, 96), head, font=f1, fill=INK, spacing=0)
|
|
sub = "A self-custody wallet with a Visa card.\nApple Pay and Google Pay.\n3% per purchase, no load fee."
|
|
f2 = font(12, bold=False); d.multiline_text((18, 160), sub, font=f2, fill=MUTED, spacing=3)
|
|
f3 = font(14); s = "Get the card"; pw, ph = pill_size(d, s, f3, 9); pill(d, w - pw - 18, h - ph - 14, s, f3, pad=9)
|
|
return im
|
|
|
|
def splash(w, h): # 600x300
|
|
im = bg(w, h); d = ImageDraw.Draw(im)
|
|
f0 = font(15); d.text((30, 26), "CRYPTO VISA CARD", font=f0, fill=MINT)
|
|
card(d, w - 230, 36, 196, 122)
|
|
head = "Spend your POL\nanywhere Visa\nis accepted."
|
|
f1 = font(40); d.multiline_text((30, 54), head, font=f1, fill=INK, spacing=0)
|
|
sub = "A self-custody wallet with a Visa card. Virtual card from $9.99. 3% per purchase, no load fee."
|
|
f2 = fit(d, sub, w - 60, 17, bold=False); d.text((30, 218), sub, font=f2, fill=MUTED)
|
|
f3 = font(18); s = "Get your card"; pw, ph = pill_size(d, s, f3, 12); pill(d, w - pw - 30, h - ph - 24, s, f3, pad=12)
|
|
return im
|
|
|
|
SIZES = {"728x90": leaderboard, "468x60": leaderboard, "300x250": rectangle, "600x300": splash}
|
|
for s, fn in SIZES.items():
|
|
w, h = map(int, s.split("x"))
|
|
im = fn(w, h)
|
|
assert im.size == (w, h)
|
|
p = os.path.join(OUT, "bixpay-" + s + ".png"); im.save(p, optimize=True)
|
|
print(p, os.path.getsize(p), "bytes")
|