分享

python3代码块2022年12月28日9点31分上传

 进分法 2022-12-28 发布于广东

#! python3
import os,openpyxl,time,pyautogui
from PIL import Image
startTime = time.localtime()
theName = (str(startTime[0]) + str(startTime[1])+ str(startTime[2]))
os.chdir('C:\\Users\\Lenovo\\Desktop\\截图和下载\\'+ str(theName))
theChineseDay = str(startTime[0]) +  '年' + str(startTime[1]) + '月' + str(startTime[2]) +'日'
print(str(theChineseDay) )
print(str(startTime[3]) + ':' + str(startTime[4]))
print('输入图片宽度和高度:')
width = input()
num = input()
height = int(width)*9/16
photoNum = int(num)//height + 1
photoToday = Image.open(str(theName)+'.png')
for i in range(int(photoNum)-1):
    m=i*height
    n= (i+1)*height
    croppedPh = photoToday.crop((0,m,int(width),n))
    croppedPh.save(str(theName)+'BT'+str(i)+'.png')
croppedPH = photoToday.crop((0,n,int(width),num-n))
croppedPh.save(str(theName)+'BT'+str(i+1)+'.png')

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多