I want to take a simple bitmap which has 6 horizontal lines of color in it like this:
red
blue
green
red
blue
green
I want to move the lines of colors around like this:
red
red
blue
blue
green
green
The code below is what I was trying to work with but I get an error message that the tuple is out of range. Is there some other code I could use for this or is it feasible to use this code with some changes?
red
blue
green
red
blue
green
I want to move the lines of colors around like this:
red
red
blue
blue
green
green
The code below is what I was trying to work with but I get an error message that the tuple is out of range. Is there some other code I could use for this or is it feasible to use this code with some changes?
Code:
import sys
import Image
import ImageFilter
im = Image.open("7.bmp").convert("L")
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)
Comment