Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- import colorsys
- img = Image.open('aa.png').convert('RGB')
- w, h = img.size
- data = img.load()
- cycles = 4
- inc = 0
- step = cycles /(w * h)
- for y in range(h):
- for x in range(w):
- r, g, b = data[x, y]
- hsv = colorsys.rgb_to_hsv(r/255, g/255, b/255)
- hue = colorsys.hsv_to_rgb(hsv[0] + inc, hsv[1], hsv[2])
- data[x, y] = tuple([int(255 * x) for x in hue])
- inc += step
- img.save('out.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement