(Python)批量读取图片尺寸

import PIL.Image as pil_image
import os
path = r'D:\Program\SwinIR\testsets\Set5\HR'
img_list = os.listdir(path)
for i in img_list:
    img_HR = pil_image.open(os.path.join(path, i)).convert('RGB')
    print('width:{0}, height:{1}'.format(img_HR.width, img_HR.height))

你可能感兴趣的:(python学习笔记,python,开发语言)