From 837fa74234f605d6aed50a0150be82219f3309c0 Mon Sep 17 00:00:00 2001 From: liubiren Date: Tue, 7 Apr 2026 20:31:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 短视频合成自动化/image.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 短视频合成自动化/image.py diff --git a/短视频合成自动化/image.py b/短视频合成自动化/image.py new file mode 100644 index 0000000..1f21184 --- /dev/null +++ b/短视频合成自动化/image.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +""" +生成图片模块 +""" + +# 列举导入模块 +import cv2 +import numpy +from pathlib import Path + +# 创建画布(默认填充为白色) +canvas = numpy.ones((1080, 1920, 3), dtype=numpy.uint8) * 255 + +# 当前文件夹路径 +current_path = Path(__file__).parent + +# 构建生成图片路径 +image_path = current_path / "111.jpg" + +print(image_path) + +success = cv2.imwrite( + filename=image_path, img=canvas, params=[cv2.IMWRITE_JPEG_QUALITY, 95] +) + +print(success)