Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- obamaImage = None
- beachImage = None
- def setup():
- global backImage
- size(500,500)
- backImage = loadImage("beach.jpg")
- image(backImage,0 ,0 ,500 ,500)
- loadPixels()
- pixelsBack = pixels[0:]
- global frontImage
- size (500,500)
- frontImage = loadImage("obama.jpg")
- image(frontImage,0,0,500,500)
- loadPixels()
- pixelsFront = pixels[0:]
- for x in range(0, width):
- for y in range(0, height):
- i = x + width*y
- if (green(pixelsFront[i]) >= 150 and red(pixelsFront[i]) <= 80 and blue(pixelsFront[i]) <= 80) or \ #this is one case where there is high green and high red and blue
- (green(pixelsFront[i]) >= 100 and red(pixelsFront[i]) <= 20 and blue(pixelsFront[i]) <= 20) : #this is another case where there is lower green, but also low red and low blue
- pixels[i] = pixelsBack[i] #mods the current selected pixels from pixelsFront when conditions are met, to be from pixelsBack
- updatePixels()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement