I have this code from the PIL-handbook but I get an error message.
from PIL import Image, ImageEnhance, ImageChops
im = Image.open("D:\\Python26\\PYTHON-PROGRAMME\\bild.jpg")
# split the image into individual bands
source = im.split()
R, G, B = 0, 1, 2
# select regions where red is less than 100
mask = source[R].point(lambda i: i < 100 and 255)
# process the green band
out = source[G].point(lambda i: i * 0.7)
# paste the processed band back, but only where red was < 100
source[G].paste(out, None, mask)
# build a new multiband image
im = Image.merge(im.mode, source)
im = im.point(lambda i: expression and 255)
im.save("D:\\Python26\\PYTHON-PROGRAMME\\bild2.jpg")
print('done')
Error:
Traceback (most recent call last):
File "D:\Python26\PYTHON-PROGRAMME\00000000000000000", line 14, in <module>
out = source[G].point(lambda i: i * 0.7)
IndexError: tuple index out of range