Files
zyt/training-videos/scripts/coach_adopt.py
T
long 3cd3553af2 feat: 新增 training-videos 素材流水线
AI 跟练的素材生产工具,产物写入 TUICallKit-Vue3/training:
- 教练动作帧:AI 设定稿 → 切帧对齐、锁脸、插帧 → 导出小程序帧与 COS 高清帧
- 示范视频:Remotion 渲染四个动作的示范视频
- 背景音乐:程序合成的原创循环音乐(npm run bgm)
2026-10-31 10:33:25 +08:00

22 lines
800 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
采用设定稿:work/sheets/<动作>.png → assets/sheets/<动作>.webp(无损,约为 PNG 的一半大小)
用法:python3 coach_adopt.py <动作> [动作 ...]
"""
import sys
from pathlib import Path
from PIL import Image
ROOT = Path(__file__).resolve().parents[1]
if __name__ == "__main__":
for move in sys.argv[1:]:
src = ROOT / "work" / "sheets" / f"{move}.png"
im = Image.open(src)
if im.mode != "RGBA" or im.getchannel("A").getextrema()[0] > 0:
raise SystemExit(f"{src.name} 不是透明背景,不能使用")
dst = ROOT / "assets" / "sheets" / f"{move}.webp"
im.save(dst, lossless=True, quality=100, method=6)
print(f"已采用 {src.relative_to(ROOT)} → {dst.relative_to(ROOT)}({im.width}×{im.height})")