error with pillow: decoder not avaliable

telmo bacile telmo.bacile at gmail.com
Thu Jul 2 09:29:30 CEST 2015


Hi list, im new in this list.
Im trying to run a python code that was made originally with pil using pillow,

The problem is that i get this error:

IOError: decoder jpeg not available



Any idea why this code is not working with pillow?





import math
from PIL import Image
imageFile = 'test.jpg'
im = Image.open(imageFile)
rgbHistogram = im.histogram()
print 'Snannon Entropy for Red, Green, Blue:'
for rgb in range(3):
    totalPixels = sum(rgbHistogram[rgb * 256 : (rgb + 1) * 256])
    ent = 0.0
    for col in range(rgb * 256, (rgb + 1) * 256):
        freq = float(rgbHistogram[col]) / totalPixels
        if freq > 0:
            ent = ent + freq * math.log(freq, 2)
    ent = -ent
    print ent


More information about the Python-list mailing list