[Image-SIG] Enhancing an Image

Bryan Fodness bryan.fodness at gmail.com
Wed Feb 18 21:08:07 CET 2009


I am new to PIL and I am trying to enhance an image.  Can someone tell
me how I can get the picture from the palette?

    import ImageEnhance

    im = Image.open('C:\\Users\\bryan\\Desktop\\Untitled.gif')
    im = im.crop([10,750,1000,910])
    im.show()
    enhancer = ImageEnhance.Sharpness(im)
    enhancer.enhance(2.0).show()

Traceback (most recent call last):
  File "C:\Python25\pytesser_v0.0.1\clinical_data.py", line 7, in <module>
    enhancer = ImageEnhance.Sharpness(im)
  File "C:\Python25\lib\site-packages\PIL\ImageEnhance.py", line 89, in __init__
    self.degenerate = image.filter(ImageFilter.SMOOTH)
  File "C:\Python25\Lib\site-packages\PIL\Image.py", line 786, in filter
    return self._new(filter.filter(self.im))
  File "C:\Python25\lib\site-packages\PIL\ImageFilter.py", line 54, in filter
    raise ValueError("cannot filter palette images")
ValueError: cannot filter palette images


More information about the Image-SIG mailing list