How can I get dimensions of image without actually downloading it? Is it even possible? I have a list of urls of images and I want to assign width and size to it.
I know there is a way of doing it locally (How to check dimensions of all images in a directory using python?), but I don't want to download all the images.
Edit:
Following ed. suggestions, I edited the code. I came up with this code. Not sure weather it downloads whole file or just a part (as I wanted).
Unfortunately I can't comment, so this is as an answer:
Use a get query with the header
And then simply use
http://code.google.com/p/bfg-pages/source/browse/trunk/pages/getimageinfo.py
If you use python's "requests", it's simply
This fixes ed.'s answer and doesn't have any other dependencies (like ReSeekFile.py).
This is based on ed's answer mixed with other things I found on the web. I ran into the same issue as grotos with .read(24). Download getimageinfo.py from here and download ReSeekFile.py from here.
Modify getimageinfo as such...