Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- width_x= 4947 ; height_x = 3092
- smearlock = False
- def setup():
- global img, smearlock
- img = loadImage("marek-piwnicki-D5T8zRDUun0-unsplash.jpg")
- size(width_x, height_x)
- def draw():
- global img, smearlock
- background(0)
- if not smearlock:
- sorter(img, 'br', 'lt', 200)
- image(img, 0, 0, width, height)
- def sorter(im, col, sign, thresh):
- global smearlock
- for x in range(im.width):
- for y in range(im.height):
- loc = x + y * im.width
- smear = (x -1) + y * im.width
- if col == 'r':
- val = red(im.pixels[loc])
- if col == 'g':
- val = green(im.pixels[loc])
- if col == 'b':
- val = blue(im.pixels[loc])
- if col == 'br':
- val = brightness(im.pixels[loc])
- if col == 'h':
- val = hue(im.pixels[loc])
- if col == 's':
- val = saturation(im.pixels[loc])
- if thresh > 255:
- thresh = 255
- if thresh < 0:
- thresh = 0
- if sign == 'gt':
- if val > thresh:
- im.pixels[loc] = im.pixels[smear]
- if sign == 'lt':
- if val < thresh:
- im.pixels[loc] = im.pixels[smear]
- smearlock = True
- def keyPressed():
- if key == 's':
- saveFrame("####.jpg")
Advertisement
Add Comment
Please, Sign In to add comment