售后服务 网站建设,百度网盘app官网下载,哪个网站的ps元素好,昆山有建设网站的吗‘ 背景需求#xff1a;
用通义万相下载简笔画茶壶、茶杯
茶杯#xff0c;简单笔画#xff0c;卡通#xff0c;黑白#xff0c;未着色#xff0c;幼儿插图#xff0c;线条画#xff0c;没有背景#xff0c;没有颜色#xff0c;黑白漫画线条艺术:#xff0c;空背景…
‘ 背景需求
用通义万相下载简笔画茶壶、茶杯
茶杯简单笔画卡通黑白未着色幼儿插图线条画没有背景没有颜色黑白漫画线条艺术:空背景粗轮廓清晰的线条矢量线。简单大 茶壶简单笔画卡通黑白未着色幼儿插图线条画没有背景没有颜色黑白漫画线条艺术:空背景粗轮廓清晰的线条矢量线。简单大 用Photoshop把图片上的小点子、表情、眼睛等图案修掉 利用模版设计一个大茶壶两个小茶壶的A4学具 图像素材准备 代码展示
#
# 21*29.719.52长方形A4
# 目的一大二小茶壶茶杯对称裁剪手环帽子等
# 作者阿夏
# 时间2024年7月27日17:27
# import os
import time
import shutil
from docx import Document
from docx.shared import Cm, Pt, Inches, RGBColor
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
from docx.oxml.ns import qn
from PyPDF2 import PdfFileMerger, PdfFileReader
from docxtpl import DocxTemplate
import pandas as pdprint(----------第1步提取所有的幼儿照片的路径------------)# 读取123文件夹下的所有图片
path rC:\Users\jg2yXRZ\OneDrive\桌面\果茶
teapot_folder os.path.join(path, 01茶壶) # 100
teacup_folder os.path.join(path, 00茶杯) # 76 以这里的数量为准teapot_files [os.path.join(teapot_folder, f) for f in os.listdir(teapot_folder) if f.endswith(.jpg) or f.endswith(.png)]
teacup_files [os.path.join(teacup_folder, f) for f in os.listdir(teacup_folder) if f.endswith(.jpg) or f.endswith(.png)]
# print(teacup_files)# 创建临时文件夹
new_folder pathr\零时文件夹
os.makedirs(new_folder, exist_okTrue)print(----------第3步一张大茶壶2个小茶杯 ------------)for nn in range(0,int(len(teacup_files))): # 读取图片的全路径 的数量 31张doc Document(pathr\果茶.docx)teacup_figuresteacup_files[nn] # 茶杯的图片teapot_figuresteapot_files[nn] # 茶壶的图片table doc.tables[0] # 45678行
## 写入1张大图rundoc.tables[0].cell(0,0).paragraphs[0].add_run() # # 图片位置 第一个表格的0 3 插入照片run.add_picture(r{}.format(teapot_figures),widthCm(19.5),heightCm(19.5))table.cell(0,0).paragraphs[0].alignment WD_PARAGRAPH_ALIGNMENT.CENTER #居中 # 写入2张小图for tt in range(2):rundoc.tables[0].cell(tt,1).paragraphs[0].add_run() # # 图片位置 第一个表格的0 3 插入照片run.add_picture(r{}.format(teacup_figures),widthCm(8.8),heightCm(8.8))table.cell(tt,1).paragraphs[0].alignment WD_PARAGRAPH_ALIGNMENT.CENTER #居中 doc.save(new_folderfr\{nn:03d}.docx) time.sleep(3)print(----------第4步把都有PDF合并为一个打印用PDF------------)# 将10个docx转为PDF
import os
from docx2pdf import convert
from PyPDF2 import PdfFileMergerpdf_output_path pathfr\果茶茶壶茶杯{len(teacup_files)}人共{len(teacup_files)}份.pdf# 将所有DOCX文件转换为PDF
for docx_file in os.listdir(new_folder):if docx_file.endswith(.docx):docx_path os.path.join(new_folder, docx_file)convert(docx_path, docx_path.replace(.docx, .pdf))# 合并零时文件里所有PDF文件
merger PdfFileMerger()
for pdf_file in os.listdir(new_folder):if pdf_file.endswith(.pdf):pdf_path os.path.join(new_folder, pdf_file)merger.append(pdf_path)
time.sleep(2)# 保存合并后的PDF文件
merger.write(pdf_output_path)
merger.close()# 删除输出文件夹
shutil.rmtree(new_folder)
# shutil.rmtree(zheng_path)
# shutil.rmtree(fan_path)
time.sleep(10)
作品展示