批量设置图片大小
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)