Steam capsules from the new key art

Every capsule, the library hero and header, the event images and the page
background are rebuilt from the key art the user sent. The tall art had no
room above the planet for the logo, so more sky was outpainted above it with
gpt-image and the original pasted back over the middle. Tools/Steam/capsules.py
makes them all again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-10 11:26:03 +06:00
parent bbf73a6b96
commit 5b14fd6635
15 changed files with 106 additions and 21 deletions

View File

@ -40,7 +40,7 @@ AppID 5551720. Страница магазина: `partner.steamgames.com/admin/
| Витрина: анимированные панели WEBM с альфой и PNG-заголовки | `showcase/*_english.*` | `py -I Tools/Steam/showcase.py` (сразу пишет с `_english`; PNG в полном RGBA, под прозрачностью цвет страницы `#1b2838`, потому что палитровую прозрачность Steam превращал в чёрный) |
| Достижения: таблица и иконки | `achievements/` | `py -I Tools/Steam/achievements.py` |
| Переводы достижений | `achievements/achievements_loc.json` | `py -I Tools/Steam/achievements_loc.py` |
| Капсулы и значки | `capsules/`, исходники в `source/` | сделаны в ChatGPT |
| Капсулы и значки | `capsules/`, исходники в `source/` | капсулы собирает `Tools/Steam/capsules.py` из key art `source/keyart_user_*` (вертикальной дорисовано небо под логотип), значки сделаны в ChatGPT |
| Скриншоты | `screenshots/` | сняты в игре |
В описании картинки вставлены как `[img]{STEAM_APP_IMAGE}/extras/<группа>[/img]`, где группа это имя файла без `_english` и расширения. Steam сам подставляет версию для языка покупателя, а если её нет, берёт английскую. При загрузке ассетов суффикс языка в имени обязателен, иначе Steam помечает файл языком интерфейса Steamworks.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

BIN
Docs/Steam/source/keyart_user_tall_sky.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

82
Tools/Steam/capsules.py Normal file
View File

@ -0,0 +1,82 @@
"""Steam capsules from the key art in Docs/Steam/source.
python Tools/Steam/capsules.py [out dir]
The wide art (keyart_user_wide.webp) makes the wide capsules, the hero and the page background; the tall one with more
sky drawn on above it (keyart_user_tall_sky.png: the original pasted back over a gpt-image outpaint) makes the tall ones.
Writes to Docs/Steam/capsules by default. The icons and the library logo are not made here.
"""
import sys, os
from PIL import Image, ImageFilter, ImageEnhance
ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'Docs', 'Steam')
OUT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(ROOT, 'capsules')
os.makedirs(OUT, exist_ok=True)
wide = Image.open(os.path.join(ROOT, 'source', 'keyart_user_wide.webp')).convert('RGB')
logo = Image.open(os.path.join(ROOT, 'source', 'logo_clean.png')).convert('RGBA')
logo = logo.crop(logo.getbbox())
tall = Image.open(os.path.join(ROOT, 'source', 'keyart_user_tall_sky.png')).convert('RGB')
def cover(img, W, H, fx=0.5, fy=0.5, zoom=1.0):
"""Scales to cover W x H (times zoom), then crops around the focus fx, fy (0..1 of the free room)."""
k = max(W / img.width, H / img.height) * zoom
im = img.resize((max(W, round(img.width * k)), max(H, round(img.height * k))), Image.LANCZOS)
x = round((im.width - W) * fx)
y = round((im.height - H) * fy)
im = im.crop((x, y, x + W, y + H))
if k > 1.2:
im = im.filter(ImageFilter.UnsharpMask(radius=2, percent=60, threshold=2))
return im
def put_logo(im, cx, cy, width):
"""The logo with its width in pixels, centred on cx, cy (fractions), with a soft shadow under it."""
lw = round(width)
lh = round(logo.height * lw / logo.width)
lg = logo.resize((lw, lh), Image.LANCZOS)
x = round(im.width * cx - lw / 2)
y = round(im.height * cy - lh / 2)
sh = Image.new('RGBA', lg.size, (10, 30, 60, 0))
a = lg.split()[3].point(lambda v: int(v * 0.45))
sh.putalpha(a)
pad = max(4, lw // 25)
shadow = Image.new('RGBA', (lw + pad * 4, lh + pad * 4), (0, 0, 0, 0))
shadow.paste(sh, (pad * 2, pad * 2), sh)
shadow = shadow.filter(ImageFilter.GaussianBlur(pad))
base = im.convert('RGBA')
base.alpha_composite(shadow, (x - pad * 2 + pad // 2, y - pad * 2 + pad))
base.alpha_composite(lg, (x, y))
return base.convert('RGB')
def save(im, name):
p = os.path.join(OUT, name)
if name.endswith('.jpg'):
im.save(p, quality=92)
else:
im.save(p, optimize=True)
print(name, im.size)
# the wide art: planet left of centre, open sky right of it, the crew along the bottom
main = put_logo(cover(wide, 1232, 706, 0.5, 0.5), 0.775, 0.235, 1232 * 0.40)
save(main, 'main_capsule_1232x706.png')
head = put_logo(cover(wide, 920, 430, 0.5, 0.9), 0.765, 0.25, 920 * 0.42)
save(head, 'header_capsule_920x430.png')
save(head, 'library_header_920x430.png')
small = put_logo(cover(wide, 462, 174, 0.5, 0.75), 0.5, 0.5, 462 * 0.62)
save(small, 'small_capsule_462x174.png')
save(cover(wide, 3840, 1240, 0.5, 0.93), 'library_hero_3840x1240.png')
ev = put_logo(cover(wide, 1920, 622, 0.5, 0.95), 0.79, 0.3, 1920 * 0.28)
save(ev, 'event_header_1920x622.png')
save(put_logo(cover(wide, 800, 450, 0.5, 0.5), 0.765, 0.25, 800 * 0.42), 'event_cover_800x450.png')
bg = cover(wide, 1438, 810, 0.5, 0.5).filter(ImageFilter.GaussianBlur(10))
bg = ImageEnhance.Brightness(bg).enhance(0.55)
bg = ImageEnhance.Color(bg).enhance(0.8)
save(bg, 'page_background_1438x810.png')
if True:
# the tall art with the sky drawn on above it: the logo goes in that sky
save(put_logo(cover(tall, 600, 900, 0.5, 0.0), 0.5, 0.155, 600 * 0.86), 'library_capsule_600x900.png')
save(put_logo(cover(tall, 748, 896, 0.5, 0.6), 0.5, 0.152, 748 * 0.66), 'vertical_capsule_748x896.png')