通過requests獲取網絡上圖片的大小

from io import BytesIO,StringIO
import requests
from PIL import Image
img_url = "https://profile.csdnimg.cn/F/6/F/3_cyj5201314"
response = requests.get(img_url)
f = BytesIO(response.content)
img = Image.open(f)
print(img.size)

輸出如下:
(75, 75)

Process finished with exit code 0

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章