批量设置图片大小

import os
from PIL import Image
 
filename = os.listdir("E:\\computer vision\\111\\test\\cleavage\\")
base_dir = "E:\\computer vision\\111\\test\\cleavage\\"
new_dir  = "E:\\computer vision\\test\\cleavage\\"
size_m = 200
size_n = 200
 
for img in filename:
    image = Image.open(base_dir + img)
    image_size = image.resize((size_m, size_n),Image.ANTIALIAS)
    image_size.save(new_dir+ img)

 

转载于:https://www.cnblogs.com/Sunnyside-Bao/p/11231939.html

你可能感兴趣的:(批量设置图片大小)