[Zope] Problem with ThumbNail Image

Dieter Maurer dieter@handshake.de
Wed, 5 Sep 2001 00:12:27 +0200 (CEST)


Sylvain Boureliou writes:
 > I would like to create a thumbnail from a jpeg file.
 > Here is the fonction i use :
 > 
 > def ThumbNail(self):
 >     import Image, os, sys
 >     texte = "ok"
 >     img = Image.open("essai.jpg")
 >     img.thumbnail((50, 50))
 >     img.save('essaiThumbnail.jpg', "JPEG")
 >     return texte
 > 
 > The file "essai.jpg" is in the Zope directory.
 > It works very well from the Python command line, but it doesn't work when i
 > use it in an external method.
 > Zope finds the file but this error is raised :
 > 
 > (i'm using Zope 2.4 win32 - Python 2.1 - PIL 1.1.1)
 > Error Type: IOError
 > Error Value: cannot identify image file
 > .....
 > File C:\Program Files\zope\Extensions\ScriptsEpinet.py, line 24, in
 > ThumbNail
 >   File c:\python21\pil\Image.py, line 902, in open
 > IOError: (see above)
Maybe, PIL does not find its JPEG module and therefore
is unable to recognize JPEG files.



Dieter