image size

Rikard Bosnjakovic bos at hack.org
Tue Apr 10 06:24:22 EDT 2001


Matthias Huening wrote:
> 
> How would I get the size of an image (gif or jpg)?
> I found a module 'imgfile' but it only seems to work on IRIX. I would need a
> module that works for Windows and Unix. Suggestions?

Use PIL.

>>> import Image
>>> img = Image.open("/tmp/gurka.jpg")
>>> img.size
(800, 600)
>>> img = Image.open("/tmp/heightfield.tif")
>>> img.size
(1280, 1024)


Manual: <URL:http://www.pythonware.com/library/pil/handbook/index.htm>

-- 
Rikard Bosnjakovic - http://a214.ryd.student.liu.se/cv/ - ICQ: 1158217

Anyone sending unwanted advertising e-mail to my address will be
charged $250 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.



More information about the Python-list mailing list