#coding=utf-8
import os #打开文件时需要
from PIL import Image
import re
import numpy as np
from PIL import Image
Start_path='G:\\datathree\\'
list=os.listdir(Start_path)
count=0
for pic in list:
path=Start_path+pic
print (path)
im=Image.open(path)
w,h=im.size
h_new=480
w_new=640
# print (pic)
# print( "图片名称为"+pic+"图片被修改")
# count=count+1
# out = im.resize((w_new,h_new),Image.ANTIALIAS)
#
# #print new_pic
#
# out.save("C:\\Users\\57296\\Desktop\\openpose-master\\examples\\test\\"+pic)
print (pic)
print("图片名称为"+pic+"图片被修改")
count=count+1
out = im.resize((w_new,h_new),Image.ANTIALIAS)
img90 = np.rot90(out)
#img90.save("C:\\Users\\57296\\Desktop\\openpose-master\\examples\\testOutput\\" + pic)
im = Image.fromarray(img90)
im = im.rotate(270)
im.save("G:\\test\\" + pic)
print ('END')
count=str(count)
print ("共有"+count+"张图片尺寸被修改")
python 修改照片分辨率
最新推荐文章于 2024-05-07 16:52:35 发布