[Tutor] Re: Python Imaging Library
Leighton Pritchard
lep@aber.ac.uk
Wed, 28 Aug 2002 10:26:43 +0100
Hi Henry,
>I downloaded the PIL version 1.1.3 that can be used with
>Python version 2.2. I do have three questions however.
>1) When I extract the files, in which directory should I extract
>them to?
>2) Once that is done, how do I tie them into the Python 2.2
>program, so that when I use import Image, etc. within a Python
>program to bring in the PIL library routines, Python will know
>where the PIL library is located?
On Windows I have Python's top directory in
F:\Applications\Python\python22, and the PIL sits in
F:\Applications\Python\python22\PIL (i.e. this is the directory which has
all the .py files in, including __init__.py).
I have a plain text file called PIL.pth in Python's top directory, whose
sole contents are "PIL" (without the quotation marks). This allows me to
use 'import Image' to bring in the PIL itself.
On Linux, my python libraries are in /usr/local/lib/python2.2 (if you're
using Linux, yours might not be), and the PIL files are in
/usr/local/lib/python2.2/site-packages/PIL. Again, there is a PIL.pth file
in /usr/local/lib/python.2./site-packages containing only "PIL" without the
quotes. This lets me use 'import _imaging' and 'import image' to bring in
the PIL.
>3) Also, am I correct in saying that if I want to open a graphic
>file and plot it on a canvas, I must use PIL? Or would I have
>been able to do that with what already comes with the Python
>2.2 download?
I think that there's a PhotoImage object in Tkinter that would allow you to
do that without PIL, but I'm happy to bow to the more experienced users on
the list over that...
--
Dr Leighton Pritchard AMRSC
T44, Cledwyn Building
Institute of Biological Sciences
University of Wales, Aberystwyth, SY23 3DD
Tel 01970 622353 ext. 2353
PGP public key - http://www.keyserver.net (0x47B4A485)