From 31768ca41c4f0baf479f9b187719ffe558a754a4 Mon Sep 17 00:00:00 2001 From: Michi Date: Wed, 14 Oct 2026 22:24:03 +0200 Subject: [PATCH] adopt_video: ADOPT frames option to cut a clip short Co-Authored-By: Claude Opus 5.5 (1M context) --- adopt_video.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/adopt_video.py b/adopt_video.py index 68bd9aa..1f48ea0 100644 --- a/adopt_video.py +++ b/adopt_video.py @@ -11,9 +11,10 @@ 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). +Optional per clip, ADOPT = {name: {"tween": bool, "shade": 0..255, "frames": n}} 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), frames +keeps only the first n raw frames (cut a clip before it goes wrong). Usage: py -3.12 adopt_video.py every clip that has frames @@ -86,9 +87,9 @@ def adopt(name): os.makedirs(DEST, exist_ok=True) for old in glob.glob(os.path.join(DEST, f"{name}_*.jpg")): os.remove(old) - raw = [np.asarray(Image.open(f).convert("RGB")) for f in frames] - scene = name.startswith("scene_") opts = ADOPT.get(name, {}) + raw = [np.asarray(Image.open(f).convert("RGB")) for f in frames[:opts.get("frames", len(frames))]] + scene = name.startswith("scene_") if opts.get("tween", not scene): raw = interpolate(raw) size = (raw[0].shape[1], raw[0].shape[0])