From 052a56bc1148be80b9bba864df9c6899c2841f8a Mon Sep 17 00:00:00 2001 From: Michi Date: Wed, 14 Oct 2026 20:37:06 +0200 Subject: [PATCH] adopt_video: optional per-clip ADOPT options (tween, shade) Co-Authored-By: Claude Opus 5.5 (1M context) --- adopt_video.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/adopt_video.py b/adopt_video.py index 0e00bec..68bd9aa 100644 --- a/adopt_video.py +++ b/adopt_video.py @@ -11,11 +11,16 @@ Sidebar scenes (scene_*) are a slow loop in the game's left column instead: no vignette and no in-between frames, but the same darkening towards the bottom the still image had (MainForm.SceneBitmap), so it blends into the dark column. +Optional per clip, ADOPT = {name: {"tween": bool, "shade": 0..255}} in the project's +VIDEO_MODULE: tween=False keeps the 49 raw frames (slow loops, half the size), shade +darkens every frame by that alpha of black (to match a dimmed backdrop in the game). + Usage: py -3.12 adopt_video.py every clip that has frames py -3.12 adopt_video.py story_old just one """ import glob +import importlib import os import sys @@ -26,6 +31,7 @@ from PIL import Image, ImageDraw, ImageFilter import _bootstrap # Projektordner (config.py, Listen) vor allen anderen Modulen import config +ADOPT = getattr(importlib.import_module(getattr(config, "VIDEO_MODULE", "video_life")), "ADOPT", {}) SRC = os.path.join(config.OUTPUT_DIR, "video") DEST = os.path.join(config.ASSETS_DIR, "Video") QUALITY = 80 @@ -82,7 +88,8 @@ def adopt(name): os.remove(old) raw = [np.asarray(Image.open(f).convert("RGB")) for f in frames] scene = name.startswith("scene_") - if not scene: + opts = ADOPT.get(name, {}) + if opts.get("tween", not scene): raw = interpolate(raw) size = (raw[0].shape[1], raw[0].shape[0]) mask = bottom_shade(size) if scene else vignette(size) @@ -90,6 +97,8 @@ def adopt(name): total = 0 for i, arr in enumerate(raw): im = Image.composite(black, Image.fromarray(arr), mask) + if opts.get("shade"): + im = Image.composite(Image.new("RGB", size, (0, 0, 0)), im, Image.new("L", size, opts["shade"])) p = os.path.join(DEST, f"{name}_{i:02d}.jpg") im.save(p, quality=QUALITY, optimize=True) total += os.path.getsize(p)