Image width, height.
Bob Ippolito
bob at redivi.com
Mon Mar 1 07:17:28 EST 2004
On 2004-03-01 06:38:11 -0500, Premshree Pillai
<premshree_python at yahoo.co.in> said:
> Hello,
>
> Is there a Py module available using which I can find
> the width and height of any image format?
ANY image format is a tall order, however PIL is pretty good at it, and
supports a large number of image formats.
>>> import Image
>>> Image.open('testorig.jpg').size
(227, 149)
Note that even if you don't have a JPEG decoder available, PIL bakes in
enough support for the format to let you get the image dimensions out
of the header. I'd imagine that this is generally true with the rest
of PIL, too.
-bob
More information about the Python-list
mailing list