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

if you wanna convert bytes to kb or mb we recommended visiting this article

Converting File Size in Python

English today is not an art to be mastered it's just a tool to use to get a result