[Image-SIG] Need help with PIL image & imagetk

Read H O L (Comp) holread at glam.ac.uk
Thu Jul 20 12:47:48 CEST 2006


Hi!
Im trying to do something relatively simple, loading up an image file, resize it, then display it on a canvas. However, im getting some strange problems, namely (output from console):

File "Geomap_0.0.2.py", line 57, in drawInitial
bgimg = ImageTk.PhotoImage(img)
File "/usr/local/lib/python2.4/site-packages/PIL/ImageTk.py", line 116, in __init__
self.paste(image)
File "/usr/local/lib/python2.4/site-packages/PIL/ImageTk.py", line 181, in paste
import _imagingtk
ImportError: /usr/local/lib/python2.4/site-packages/PIL/_imagingtk.so: undefined symbol: Tk_PhotoPutBlock_NoComposite

(Geomap_0.0.2.py is the program i am trying to create).

Basicly Im doing the following:

from PIL import Image, ImageTk

<snip>

img = Image.open('./files/map.gif')
bgimg = ImageTk.PhotoImage(img)
self.background = self.canvas.create_image(0,0,image=bgimg, anchor=NW)

I havent event got as far as trying to resize the image, when the errors come up as above. If I do not use Image and ImageTk I can get the image to display on the canvas using PhotoImage, however, I cannot resize an image using PhotoImage alone (as far as i am aware), which I need to do.

I read on another website that it may be down to my TK being out of date, I have downloaded the latest stable (8.4) versions of TCL and TK, compiled and installed them, but to no avail. Any ideas? I really need to be able to resize images! Is it possible to do with PhotoImage?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20060720/ef847e5f/attachment.htm 


More information about the Image-SIG mailing list