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))