[Zope] Problems with ImageFile

Chris McDonough chrism@zope.com
Thu, 30 May 2002 18:47:45 -0400


Replace:

import Image, ImageFile

With:

from PIL import Image, ImageFile

HTH,

- C

Juan Pablo Romero wrote:
> Hello
> 
> 
> I'm trying to create an image using PIL within an external method. I
> followed the 'makeThumbnail' example, from the Zope book. This is some
> of the code:
> 
> ----------------------
> import Image, ImageDraw
> from StringIO import StringIO
> ...
> im = Image.new( ... )
> ...
> sf = StringIO()
> im.save(sf, "JPEG")
> ...
> ----------------------
> 
> when executed within zope, this code gives an error message, saying
> something about "...'ImageFile' module has no attribute '_save'..."
> 
> So I looked for ImageFile, and found that PIL (1.1.3) has his own
> ImageFile module:
> 
> 	Zope-2.5.0-linux2-x86/lib/python2.1/site-packages/PIL/ImageFile.pyc
> 
> 
>  (the one that should be imported within the 'save' method above), but
> instead, Zope's own ImageFile module gets imported:
> 
> 	Zope-2.5.0-linux2-x86/lib/python/ImageFile.pyc
> 
> What is the proper solution?
> 
> 
> Regards,
> 
> 
>   Juan Pablo
> 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"