import os
from PIL import Image
path1 = 'C://Users/kiven/Desktop/img/hxt/' #
path2 = 'C:/Users/kiven/Desktop/img/imgs/' #
Line = os.listdir(path1)
for img in Line:
images = Image.open(path1 + img)
imgName = str(img)
sImgName = imgName[-9:-4]
print(sImgName)
images.save(sImgName + '.jpg')
网友评论