Thanks Josiah I thought as much... Still, it'll help me immensely to cut the downloads from a page to only those that are within a file-size range, even if this gets me some images that are out-of-spec dimensionally.
Cheers, Al. (Oh, and if anyone still has a bright idea about how to get image dimensions without downloading, it'd be great to hear!) Josiah Manson wrote: > In the head of an HTTP response, most servers will specify a > Content-Length that is the number of bytes in the body of the response. > Normally, when using the GET method, the header is returned with the > body following. It is possible to make a HEAD request to the server > that will only return header information that will hopefully tell you > the file size. > > If you want to know the actual dimensions of the image, I don't know of > anything in HTTP that will tell you. You will probably just have to > download the image to find that out. Relevant HTTP specs below if you > care. > > http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html > http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html > > The above is true regardless of language. In python it appears there an > httplib module. I would call request using the method head. > > http://docs.python.org/lib/httpconnection-objects.html > > [EMAIL PROTECTED] wrote: > > Hi there: a bit of a left-field question, I think. > > I'm writing a program that analyses image files downloaded with a basic > > crawler, and it's slow, mainly because I only want to analyse files > > within a certain size range, and I'm having to download all the files > > on the page, open them, get their size, and then only analyse the ones > > that are in that size range. > > Is there a way (in python, of course!) to get the size of images before > > or without downloading them? I've checked around, and I can't seem to > > find anything promising... > > > > Anybody got any clues? > > > > Cheers, Al. -- http://mail.python.org/mailman/listinfo/python-list