GIF Image Size

Greg Landrum glandrum at my-deja.com
Tue Jan 2 14:52:52 EST 2001


In article <Wxp46.24381$F_3.940941 at newsread2.prod.itd.earthlink.net>,
  "Rindolf" <rindolf2 at yahoo.comNOSPAM> wrote:
> Is there any way to find out the dimensions of a GIF image using
python? I
> looked in the language reference and it didn't look like there was.
>

If you are going to be working with GIFs (or any image format for that
matter), you probably want to install PIL:
http://www.pythonware.com/products/pil/index.htm
Once you have that installed, you can easily determine the size of a GIF
as follows:
from Pil import Image
img = Image.open('foo.gif')
print img.size

I hope this helps,
-greg


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list