simple image processing in python

Kevin Cazabon kcazabon at home.com
Tue Oct 10 22:02:20 EDT 2000


The "current" version of PIL (Python Imaging Library) is very up to date...
you're probably looking at version 0.3 or something like that.

Check out www.pythonware.com for the latest versions.  They have the 1.1
source files available, as well as 1.0 pre-compiled for Windows (and links
to Linux binaries too).  You can easily get the sizes of the files with PIL,
without loading the entire image.

#sample
import Image

im = Image.open("c:/temp/test.tif")
size = im.size

print size

>>> (768, 512)

PIL doesn't actually load the data until you perform an operation that
requires that it is loaded... so just getting the size is very quick, even
with a 400MB image file.

Kevin.


"Feiyi Wang" <fwang2 at mcnc.org> wrote in message
news:Pine.LNX.4.10.10010101841440.11339-100000 at worf.mcnc.org...
| hi,
|
| I have a simple need of geting image size from either .jpg or .tif. I
| didn't find any suitable library from standard python distribution, and
| python imaging SIG got a distribution which seems pretty old (1997).
|
| I wonder what is usually/effective way to get it done?
|
| Thanks for your help
|
| Feiyi
|





More information about the Python-list mailing list