获取PIL.Image格式的图片的shape

from PIL import Image

pth = '/root/autodl-tmp/data/bgm/background_images/train/interior_355.hba-home-featured-project-image-01.jpg'
img = Image.open(pth)
print(type(img))
# print(img.shape) #    raise AttributeError(name)
print(img.size)
# (1907, 1208)

你可能感兴趣的:(PIL,python,深度学习,神经网络)