Last modified: February 18, 2020

getting image size from url using requests

In this tutorial, we gonna learn how to get image size without opening the image means just from image URL

you need to install requests library

Syntax


requests.get('img_url').content
    

Example


import requests
img_size = requests.get('https://pytutorial.com/theme/img/articles_image/py.jpg').content
print(len(img_size))

Output

87895 bytes