feat: 新增代码
This commit is contained in:
12
video_worker/app/utils/image_utils.py
Normal file
12
video_worker/app/utils/image_utils.py
Normal file
@@ -0,0 +1,12 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user