本地12345from PIL import Imagefp = '/Users/wxnacy/Documents/[email protected]'i = Image.open(fp)print(i.size) # 获取宽高 (w,h)print(i.format) # 获取图片格式网络图片1234567from PIL import Imageimport ioimport requestsurl = ''i = Image.open(io.BytesIO(requests.get(url).content))print(i.size) # 获取宽高 (w,h)print(i.format) # 获取图片格式