Re: Reading image dimensions with PIL

2005-05-18 Thread Will McGugan
Fredrik Lundh wrote: > the "right" way to do this is to use the ImageFile.Parser class. see the > last snippet on this page for an example: > > http://effbot.org/zone/pil-image-size.htm Excellent, thanks. Will -- http://www.willmcgugan.com "".join( [ {'*':'@','^':'.'}.get(c,None) or chr

Re: Reading image dimensions with PIL

2005-05-18 Thread Fredrik Lundh
Will McGugan wrote: > I'm writing an app that downloads images. It rejects images that are > under a certain size - whithout downloading them completely. I've > implemented this using PIL, by downloading the first K and trying to > create a PIL image with it. PIL raises an exception because the fi

Re: Reading image dimensions with PIL

2005-05-18 Thread Will McGugan
Dave Brueck wrote: > > > If you're tossing images that are too _small_, is there any benefit to > not downloading the whole image, checking it, and then throwing it away? Its a 'webscraper' app that downloads images based on search criteria. The user may want only images above 640x480, althou

Re: Reading image dimensions with PIL

2005-05-17 Thread Dave Brueck
Will McGugan wrote: > I'm writing an app that downloads images. It rejects images that are > under a certain size - whithout downloading them completely. I've > implemented this using PIL, by downloading the first K and trying to > create a PIL image with it. PIL raises an exception because the

Reading image dimensions with PIL

2005-05-17 Thread Will McGugan
Hi, I'm writing an app that downloads images. It rejects images that are under a certain size - whithout downloading them completely. I've implemented this using PIL, by downloading the first K and trying to create a PIL image with it. PIL raises an exception because the file is incomplete, bu