Advertisement
Guest User

Untitled

a guest
May 1st, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. from PIL import Image
  2. import colorsys
  3. img = Image.open('aa.png').convert('RGB')
  4. w, h = img.size
  5. data = img.load()
  6.  
  7. cycles = 4
  8. inc = 0
  9. step = cycles /(w * h)
  10. for y in range(h):
  11. for x in range(w):
  12. r, g, b = data[x, y]
  13. hsv = colorsys.rgb_to_hsv(r/255, g/255, b/255)
  14. hue = colorsys.hsv_to_rgb(hsv[0] + inc, hsv[1], hsv[2])
  15. data[x, y] = tuple([int(255 * x) for x in hue])
  16. inc += step
  17.  
  18. img.save('out.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement