Files
AI_A4000/video_worker/app/utils/image_utils.py
2026-04-07 00:37:39 +08:00

13 lines
498 B
Python

from pathlib import Path
from PIL import Image, ImageDraw, ImageFont
def make_dummy_frame(path: Path, width: int, height: int, text: str, step: int) -> None:
image = Image.new("RGB", (width, height), color=(25 + step * 5 % 200, 40, 60))
draw = ImageDraw.Draw(image)
font = ImageFont.load_default()
draw.text((16, 16), text, fill=(240, 240, 240), font=font)
draw.text((16, 38), f"frame={step}", fill=(220, 220, 220), font=font)
image.save(path, format="JPEG", quality=90)