This commit is contained in:
parent
cf790bc3db
commit
837fa74234
|
|
@ -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)
|
||||
Loading…
Reference in New Issue