Program to download an image from a given URL
import requests
url = f"https://c4.wallpaperflare.com/wallpaper/296/372/981/wall-e-pixar-disney-movies-wallpaper-preview.jpg"
response : requests.Response = requests.get(url)
print(response.headers)
I want to understand how to find out the dimensions(width x height)
of image.
Content-Length
which is in headers
of the response
gives how many bytes
(including red, green & blue channel) that image contains but not the dimensions.
response.content
gives the content of image which are bytes but how to find the dimension of the image?
Using PIL.Image.size
we can also get the size of image but I want to understand how to get that from response
which we get.
I have refferred this question of StackOverflow but the answer by ElJeffe I cannot understand.