Looks like someone else is having a problem as well from the other day with 
this module. Here's my problem, when trying to posterize an image with ImageOps 
I get the output error below when executing from my script. When I'm in the 
python shell and interactively executing each command the posterize process 
seems to work, no errors are generated.

Python 2.5.1
SunOS 5.10


Here's the output when executing from the script. A copy of the script is 
provided next, then output of me typing in the commands manually.

/path/(30): tmp.py
Traceback (most recent call last):
  File "tmp.py", line 6, in <module>
    im = ImageOps.posterize(im, 8)
  File "/usr/local/lib/python2.5/site-packages/PIL/ImageOps.py", line 391, in 
posterize
    return _lut(image, lut)
  File "/usr/local/lib/python2.5/site-packages/PIL/ImageOps.py", line 57, in 
_lut
    return image.point(lut)
  File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 1094, in 
point
    self.load()
  File "/usr/local/lib/python2.5/site-packages/PIL/ImageFile.py", line 155, in 
load
    self.load_prepare()
  File "/usr/local/lib/python2.5/site-packages/PIL/ImageFile.py", line 223, in 
load_prepare
    self.im = Image.core.new(self.mode, self.size)
  File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 36, in 
__getattr__
    raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed

#!/usr/local/bin/python2.5

import Image, ImageOps, sys

im = Image.open('imagefile.jpg')
im = ImageOps.posterize(im, 8)

imData = im.histogram()
i = 0
for ea in imData:
  if ea > ((im.size[0] * im.size[1]) / 4):
    print "BAD"
  i = i + 1



/path(31): /usr/local/bin/python2.5
Python 2.5.1 (r251:54863, May 16 2007, 19:58:05)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image, ImageOps
>>> im = Image.open('imagefile.jpg')
>>> im = ImageOps.posterize(im, 8)
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to