读取图片大小
from PIL import Image
img_path = '../lits_data/train/images/volume-28_0.png'
img = Image.open(img_path)
imgSize = img.size
w = img.width
h = img.height
f = img.format
print('size:', imgSize)
print('长度:', w)
print('宽度:', h)
print('格式:', f)
'''size: (512, 512)
长度: 512
宽度: 512
格式: PNG'''
![在这里插入图片描述](https://img-blog.csdnimg.cn/9465798c501f4ae6a54506a5a1638086.jpg?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA56ug6bG85ZOlenlu,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)