logo
  • Python
  • Django
  • About
  • Contact

Last modified: Jan 10, 2023 By Alexander Williams

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

Recent Tutorials:

  • Convert Your Django Project to a Static Site and Host it for Free
  • How to Remove Comma in Number Python
  • 4 Ways to Find a Word in a List in Python: A Comprehensive Guide
  • How to read a string word by word in Python
  • 3 Easy Methods for Capitalizing Last Letter in String in Python
  • Find shortest word in string, list, tuple Python
  • How To Solve no module named datasets
  • Python Get Root and Sub Domain From URL

Related Tutorials:

  • 3 Easy Methods for Capitalizing Last Letter in String in Python
  • How To Solve no module named datasets
  • Python Get Root and Sub Domain From URL
  • Python-pycountry | Understand How to Use pycountry
  • Python: Get First, Second, Last word in String
  • Python Check if String is Datetime
  • Remove HTTPS or HTTP From URL Python
  • How to Skip a Value in a List python
  • Facebook
  • Twitter
  • Youtube

Copyright PyTutorial Blog Co.