[Tutor] Jimage reader. How to find the pixels?

Kent Johnson kent37 at tds.net
Sun Jun 12 21:39:30 CEST 2005

Joseph Quigley wrote:
> I have finally made my very first GUI program!! It needs some work 
> before I would ever consider putting it on sourceforge (ha ha ha). I 
> have a problem though. I can't find an image lib that will detect the 
> picture's height and width automatically. I can use wave to detect mono 
> or stereo but that's another story. Oh, one more thing, how can I make 
> it so that I can type: python jimagereader.py /home/joe/pic.jpeg  
> instead of the prompt within the program: Image name:

The Python Imaging Library can detect how big the image is and open a window to display it. The size is also available as the 'size' attribute of a PIL Image. To get the input from the command line look at sys.argv.

PIL installs a simple image viewer as Python/Scripts/pilview.py.

PIL is here: http://www.pythonware.com/products/pil/


More information about the Tutor mailing list