Andrew Dalke dalke at
Sun Nov 18 20:33:12 CET 2001

Ben Ocean:
>In PHP there is a library function called getimagesize(). What is the
>equivalent in python?

There are many possible answers.  You probably want to install
PIL (see ).
With it, you open the image (with and get the
'size' attribute, which the tuple of (width, height).

You could call external programs like ImageMagick or the
pbmutils to get the image size.

On IRIX, for .rgb files you can use imgfile.getsizes and
for jpeg the jpeg module.  Assuming they were built.

In wxPython use wxImage's GetWidth and GetHeight.

But in the core library there isn't any built-in function
for this.

                    dalke at

More information about the Python-list mailing list